Android GridView draw dividers

In case you want just simple lines as borders, much, much simpler is setting a background color for a GridView and proper padding & spacing: <GridView (…) android:background=”@color/LightGold” android:listSelector=”@android:color/transparent” android:horizontalSpacing=”1dip” android:verticalSpacing=”1dip” android:paddingLeft=”1dip” android:paddingTop=”1dip” />

How to add (vertical) divider to a horizontal LinearLayout?

use this for horizontal divider <View android:layout_width=”1dp” android:layout_height=”match_parent” android:background=”@color/honeycombish_blue” /> and this for vertical divider <View android:layout_width=”match_parent” android:layout_height=”1dp” android:background=”@color/honeycombish_blue” /> OR if you can use the LinearLayout divider, for horizontal divider <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” > <size android:height=”1dp”/> <solid android:color=”#f6f6f6″/> </shape> and in LinearLayout <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:divider=”@drawable/divider” android:orientation=”vertical” android:showDividers=”middle” > If you … Read more

Android ListView Divider

Folks, here’s why you should use 1px instead of 1dp or 1dip: if you specify 1dp or 1dip, Android will scale that down. On a 120dpi device, that becomes something like 0.75px translated, which rounds to 0. On some devices, that translates to 2-3 pixels, and it usually looks ugly or sloppy For dividers, 1px … Read more