how to change the color of Divider in Listview

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

how to change the color of Divider in Listview

Postby nbagade » Wed Jan 20, 2010 4:23 pm

Hi all,

I have ListView having imageview and textview in each List Item.

after each list item divider will display.
I want to change the color of that divider.

any one have idea.?

thanks,
Narendra
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Top

Postby dystopia » Thu Jan 21, 2010 7:08 am

Have you tried "android:divider" in your listview's layout?

android:divider="@color/white"
android:dividerHeight="5dip"
User avatar
dystopia
Freshman
Freshman
 
Posts: 2
Joined: Mon Dec 31, 2007 9:55 pm
Location: Silicon Valley

Postby nbagade » Thu Jan 21, 2010 7:24 am

Hi,

No I am creating listview through code.

so how to change the divider color of listview in Java file.

Thanks
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby dystopia » Thu Jan 21, 2010 7:18 pm

Hmm, maybe something like this will work?

ListView listView = (ListView) findViewById(android.R.id.list);

ColorDrawable color1 = new ColorDrawable(0xffff0000);
//ColorDrawable color2 = new ColorDrawable(Color.WHITE);

listView.setDivider(color1);
User avatar
dystopia
Freshman
Freshman
 
Posts: 2
Joined: Mon Dec 31, 2007 9:55 pm
Location: Silicon Valley

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 10 guests