2012年7月21日 星期六

Android: how to set ListView background, ImageButton background as transparent!!

Sometimes we need a transparent background in Listview and imagebutton,

How to set it in XML?

Here is the answer:

in ImageButton

add this line

android:background="@android:color/transparent"

be noticed that when background of a ImageButton was set to transparent, it will fit the size of it's image.


And in ListView, add this

android:cacheColorHint="#00000000"





沒有留言:

張貼留言