Shraddha Shravagi
Shraddha Shravagi

Reputation: 1136

Listview with icons

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.

enter image description here

When the item is selected the empty icon is seen.

can some one help me for this?

Thanks

Upvotes: 0

Views: 202

Answers (3)

Paresh Mayani
Paresh Mayani

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

superM
superM

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

kingori
kingori

Reputation: 2616

how about set that image's visibility to "gone" or "invisiblie"?

Upvotes: 1

Related Questions