Android: ListView background color when not enough items fill. [Screenshot] -
so have listview. items have own drawable.
the divider own drawable.
now, when have listview, seen in screenshot below, empty area without enough elements fill, it's white.
i've tried setting cache color hint, doesn't solve (honestly can't think of else may wrong it).
any appreciated.
adding code...
my listview creation , properties:
final listview v = new listview(this.getactivity()); fl.setbackgroundcolor(color.transparent); v.setbackgrounddrawable(this.getactivity().getresources().getdrawable(r.drawable.item_selector_bad)); v.setdivider(new colordrawable(color.parsecolor("#00000000"))); v.setdivider(this.getactivity().getresources().getdrawable(r.drawable.item_square)); v.setcachecolorhint(color.transparent); v.setselector(this.getactivity().getresources().getdrawable(r.drawable.item_selector_bad)); v.setdividerheight(20);
as xml files, general layout such
a item in list has:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/item_square"> </item> <item android:drawable="@drawable/item_green"> </item> </layer-list>
the item_square just:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/light_grid" android:tilemode="repeat" > </bitmap>
the item_green:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="@color/light_green" /> <corners android:bottomleftradius="25dp" android:bottomrightradius="25dp" android:topleftradius="25dp" android:toprightradius="25dp" /> </shape>
so, thought of solution, however, read has performance hit. imagine it's not bad, , if is, i'll sure re-post , add bounty. however, make listview use wrap content height.
white space around list view items
their many more questions similar this.
Comments
Post a Comment