padding: set the padding from the all side’s of the image view.paddingBottom: set the padding from the bottom side of the image view.paddingTop: set the padding from the top side of the image view.paddingLeft: set the padding from the left side of the image view.paddingRight: set the padding from the right side of the image view.padding: padding attribute is used to set the padding from left, right, top or bottom of the Imageview. tBackgroundColor(Color.BLACK) //set black color in background of a image view in java classĤ. ImageView simpleImageView=(ImageView) findViewById(R.id.simpleImageView) *Add in Oncreate() funtion after setContentView()*/ In below example code we set the black color in the background of a image view. We can also set the background at run time programmatically in java class. We can set a color or a drawable in the background of a ImageView.īelow is the example code in which we set the black color in the background and an image in the src attribute of image view. background: background attribute is used to set the background of a ImageView. ImageView simpleImageView=(ImageView) findViewById(R.id. For that we use setImageResource() method as shown in below example code. We can also set the source image at run time programmatically in java class. Below is the example code in which we set the source of a imageview lion which is saved in drawable folder.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |