Android
Android

Reputation: 3868

how to write on border of edit text

I need to create an edit text which contains some text relevant to that text box. How to do that. Although there are some ways through HTML. But I have no clue how to do that in android. Can any body suggest me something for that. For clear view I am providing sample shot of my requirement.

Any help will appreciated

enter image description here.....

Upvotes: 4

Views: 902

Answers (2)

MKJParekh
MKJParekh

Reputation: 34291

You can achieve somethin like that by doing this way,

    <RelativeLayout android:layout_width="fill_parent"
        android:id="@+id/myLayout1" android:layout_height="wrap_content">

        <EditText android:text="EditText" android:id="@+id/editText1" android:layout_marginTop="5dp" 
        android:layout_width="fill_parent" android:layout_height="wrap_content">
        </EditText>

        <TextView android:text="TextView" android:id="@+id/textView3" android:layout_marginLeft="10dp" android:textColor="#000000" android:background="#FFFFFF"
        android:layout_width="wrap_content" android:layout_height="wrap_content">
        </TextView>

    </RelativeLayout>

Image of my testing

Upvotes: 2

Yugandhar Babu
Yugandhar Babu

Reputation: 10349

I think using android:hint is also useful to place some text relevant to edit text.

But, it will show the text only when the edit text is empty and also inside the edit text, but not as you shown here.

I think the layout you shown here may take more time to implement.

Upvotes: -1

Related Questions