Having a separator in LinerLayout using android: divider and android: showDividers

I am trying to have 2 separators between 3 text views. I use android:dividerand android:showDividers. However, the vertical divider is not shown. I was wondering if there is something that I missed?

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:orientation="horizontal"
    android:divider="?android:attr/dividerVertical"
    android:dividerPadding="12dip"
    android:showDividers="middle" >

    <TextView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical|center_horizontal"
        android:text="ABC" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical|center_horizontal"
        android:text="EFG" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical|center_horizontal"
        android:text="HIJ" />

</LinearLayout>
+5
source share
1 answer

Separators in LinearLayouts are only available from API 11. I assume you are testing a lower API. See the Docs for more information . However, you can use the IcsLinearlayout from the ABS package for backward compatibility.

+7
source

All Articles