android listview item style? -


before posted thread , i've googled ( how style listview items ) cannot find example showing how style listview item ( normal , touch , long click etc ) background colors want vk listview border radius , box shadow , please need other people searching there example or can 1 tell me have put inside xml selector background of item ?

image 1 show how listview item has border radius , shadow

enter image description here

image 2 showing when click on item

enter image description here

so guys there way ?

sure, it's best use styles here:

<!-- res/values/styles.xml --> <style name="listview" parent="@android:style/widget.listview">     <item name="android:background">@color/light_grey</item>     <item name="android:cachecolorhint">@android:color/transparent</item>     <item name="android:divider">@android:color/transparent</item>     <item name="android:dividerheight">0dp</item>     <item name="android:listselector">@drawable/list_item_selector</item> </style> 

the @color/light_grey definition:

<!--- res/values/colors.xml ---> <?xml version="1.0" encoding="utf-8"?> <resources>    <color name="light_grey">#cccccc</color> </resources> 

you'll have define light_grey color in colors.xml , create card style list_item_selector.xml in drawables folder:

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">         <item android:drawable="@drawable/item_selected" android:state_pressed="true"/>     <item android:drawable="@drawable/item_focused" android:state_focused="true"/>     <item android:drawable="@drawable/item_normal"/>  </selector>  

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -