开发者

Listview with icons

开发者 https://www.devze.com 2023-04-05 15:01 出处:网络
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

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 cl开发者_如何学JAVAicked then an empty space is seen.

Have a look at the image below.

Listview with icons

When the item is selected the empty icon is seen.

can some one help me for this?

Thanks


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


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)


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);

0

精彩评论

暂无评论...
验证码 换一张
取 消