I\'m trying to add a divider to a horizontal linear layout but am getting nowhere. The divider just doesn\'t show. I am a total newbie with Android.
This is my layou
If you are using the AppCompat library v7 you may want to use the LinearLayoutCompat
view. Using this approach you can use drawable dividers on Android 2.1, 2.2 and 2.3.
Example code:
drawable/divider.xml: (divider with some padding on the top and bottom)
Very important note: The LinearLayoutCompat
view does not extend LinearLayout
and therefor you should not use the android:showDividers
or android:divider
properties but the custom ones: app:showDividers
and app:divider
. In code you should also use the LinearLayoutCompat.LayoutParams
not the LinearLayout.LayoutParams
!