How can I replicate a colored separator in Android Layout XML?

I need to replicate a legacy form that looks like this:

enter image description here What is the Android equivalent for the "colored separators" setting off the UserName and Password portion of the screen? An ImageView? A TextView? Is something in the drawable folder in my future? Or...?

UPDATE

Der Golam's first example was perfect, except I needed some space, so I added the Space element after the top separator and before the bottom separator:

<Space
    android:layout_width="wrap_content"
    android:layout_height="6dip" />

UPDATE 2

On third thought, it's better to 86 the Space and just use one of the View element's margin properties, such as layout_marginTop or layout_marginBottom:

android:layout_marginTop="6dip"

Upvotes: 1

Views: 35

Answers (1)

Phant&#244;maxx
Phant&#244;maxx

Reputation: 38098

It's just as simple as laying a generic View:

<!-- A horizontal line - play with the color and with the height -->
<!-- Play with margins, too -->
<View
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="#f800"
/>

<!-- A vertical line - play with the color and with the width -->
<!-- This can be nice as a ListView Item "bullet" -->
<View
    android:layout_width="2dp"
    android:layout_height="match_parent"
    android:background="#f008"
/>

You might want to use a more complex fill, such as a gradient...
Curious? wanna try?
Here's a simple tutorial, just in case: http://envyandroid.com/archives/242/drawable-gradient-lines-android

Upvotes: 1

Related Questions