Lester1992
Lester1992

Reputation: 493

edit text with label inside in android

enter image description here

can anyone know how to make this?

i think this is a editText but how can i put a label and text at the same time?

thanks in advance

Upvotes: 5

Views: 5780

Answers (2)

Bruno L.
Bruno L.

Reputation: 525

Also you can use the 'hint' property: android:hint="@string/hint_email"

Then, the text label is ignored when you input a value.

For setting color of hint texts, see stackoverflow here

Upvotes: 1

Abhishek Sabbarwal
Abhishek Sabbarwal

Reputation: 3808

Try this out :

<FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

    <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="40dp" >

        <requestFocus />
    </EditText>

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:paddingLeft="10dp"
            android:text="Gender" />
</FrameLayout>

Hope it helps.

Upvotes: 7

Related Questions