Reputation: 537
I am able to setup a listview using custom adapter which shows correct output..Now i want to change the background of each listview items to a gradient.. how it could be done?
My files...
activity_main.xml....Main xml file
MainActivity.java....Main activity
Item.java.... item selector method
ItemAdaptor.... custom adapter
list_item.xml..... item (textView) styling
I have created my gradient code which is like..
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FFFAFAFA"
android:centerColor="#FFFFFFFF"
android:endColor="#FFFAFAFA"
android:angle="90"/>
</shape>
also how could I change the separator color,and the background color of the whole listview..
Upvotes: 1
Views: 5554
Reputation: 3500
Have a look on this tutorial
author created list-view with gradient effect, I think this is exactly what you need.
Upvotes: 1
Reputation: 1136
Have you mentioned android:background="@drawable/customshape"
in your rowLayout.xml so that it knows which shape is to be used? Also use android:divider="#FFCC00"
in your listview tag to change the seperator color. Add <solid android:color="#F0F0F0" />
to your shape so as to change the background color.
Upvotes: 1