I have following layout for a list view item.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border"
android:orientation="vertical"
android:paddingBottom="1dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light">
....
</LinearLayout>
</LinearLayout>
The background of outer layout (@drawable/border
) is grey color, and since the paddingBottom
of outer layout is 1dp
and inner layout background is white, there is a grey line between each list view item.
But, in low res (ldpi) devices, this grey line is not visible.
If I change the padding of outer layout to 2dp
, grey line becomes visible, but it looks too thick in high res devices. A better result can be achieved by using 2px
instead of 2dp
.
What is the best way to show the grey border line in low res devices?