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
#1 by Jas on December 21, 2010 - 5:56 am
Quote
Good example. I used the code one creating dynamically.
#2 by Ron L. on February 2, 2011 - 7:36 am
Quote
Thanks for that.
I put the xml between a couple of tablelayouts inside of a framelayout. Worked beautifully.
#3 by Dom on September 14, 2011 - 2:59 pm
Quote
Nice tip.
I’ve been looking for this so long.