Creating a horizontal rule (line) in Android

Use a View with fixed height -


 android:layout_width="fill_parent"
 android:layout_height="2dip"
 android:background="#FF00FF00" />

or, in code -

View ruler = new View(myContext); ruler.setBackgroundColor(0xFF00FF00);
theParent.addView(ruler,
 new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, 2));

Source – Romain Guy

12 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*


seven + 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>