Muhammad Umar
Muhammad Umar

Reputation: 11782

Making edittext show values

i am new to android and i am trying to do this

The required Image

Please tell me how to do that when i enter some amount it should show up just like that.

Upvotes: 1

Views: 78

Answers (3)

user1196514
user1196514

Reputation:

You can have a RelativeLayout having one TextView (Amount), and one EditText (value). Set background of EditText to #0000000, and RelativeLayout's image you have displayed here. Set TextView alignment to

  left_align_parent=true

and EditText

    android:gravity="right" 

Upvotes: 0

Dex
Dex

Reputation: 72

Here you go, you might have to tweak the margins and text styles but this is what you want:

<RelativeLayout android:id="@+id/container
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white">

    <TextView android:id="@+id/amountLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black"
        android:textStyle="bold"
        android:layout_marginLeft="5dp"
        android:layout_centerVertical="true"
        android:text="Amount"
        android:layout_alignParentLeft="true"/>

    <EditText android:id="@+id/amount" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="5dp"
</RelativeLayout>

Upvotes: 2

jeet
jeet

Reputation: 29199

You can have a relativelayout having one TextView(Amount), and one TextView(value). Set background of EditText to #0000000, and relativeLayout's image you have displayed here. Set TextView alignment to left_align_parent=true, and EditText's align_parent_right.

Upvotes: 0

Related Questions