Search code examples
androidlistviewcolorsdivider

How to Set ListView Divider Color With hex Color?


I am using this code to set ListView divider with hex color and it doesnot work!!

ListView list = (ListView) act.findViewById(R.id.menu_listview);

SlideMenuItem[] items = menuItemList
        .toArray(new SlideMenuItem[menuItemList.size()]);

SlideMenuAdapter adap = new SlideMenuAdapter(act, items, font);

// side menu divider color
 list.setDivider(new ColorDrawable(Color.parseColor("#000000")));
list.setAdapter(adap);

Solution

  • "It doesn't work" is no problem description, but I guess the divider is not appearing... try :

    list.setDividerHeight( xyz );
    

    ...and make sure everything else isn't black as well.