Reputation: 1136
I have an listview with Icons. Email and star.
Now at runtime I will be populating an image and if no image is there then I want to show no icon or an transparent image. Now my problem is that I have sent an transparent image by default and for the rest I populate an Icon. But when the List is clicked then an empty space is seen.
Have a look at the image below.
When the item is selected the empty icon is seen.
can some one help me for this?
Thanks
Upvotes: 0
Views: 202
Reputation: 128428
Let me update the Kingori's answer properly.
Just set the visibility as "Visible" whenever image is available:
=> iconImageView.setVisibility(View.VISIBLE);
And set the visibility as "Invisible" or "Gone" whenever image is NOT available.
=> iconImageView.setVisibility(View.GONE);
Upvotes: 1
Reputation: 8695
Do not use a transparent image, set the visibily of the image to GONE (and add margin to the image below if star is gone)
Upvotes: 1