Android - divider between items in vertical layout
19,288
Solution 1
You can use a textview to create a divider line
Example:
<TextView
android:layout_width="fill_parent"
android:layout_height="1px"
android:background="#DADADA" />
Solution 2
You can insert View
with background of any color you want and
layout_height = "1dp"
(or more if necesary) and
layout_width="fill_parent"
.
Author by
user802609
Updated on June 04, 2022Comments
-
user802609 almost 2 years
Possible Duplicate:
Android Drawing Separator/Divider Line in Layout?I am making something similar to a list view, without actually making a list view...
I have a bunch of text views in a vertical layout, and I am wondering if it is possible to get some sort of divider line in between them. The line dividers like they have in List Views..
Any help?
-
Josh over 12 yearsDoesn't need to be a TextView, a regular View will do fine and will render faster.
-
Sam over 12 yearsYep, I just wanted to give an example.
-
rndstr over 12 yearsYou should be using
dp
instead ofpx
-
Jarad Duersch about 11 yearsno do not use dp in this instance because android will scale down the 1dp to .75 px on lower dpi screens and that will be 0px. px is correct