0

I have an EditText where the user can put in a desired amount of products.

Now what i wish to do is, that the EditText input starts from the end and fills up to the beginning.

Example:

Amount: _ _ _ _ 4 5

and not

Amount: 4 5 _ _ _ _

The _ _ _ should demonstrate the EditText.

Thanks in advance.

Sanctuary
  • 23
  • 3

7 Answers7

1

Set android:gravity="end"

<EditText
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:gravity="end"
     android:hint="type here" />

You can use

android:textDirection="rtl" // Works if you set MIN API level 17
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Ankita
  • 1,129
  • 1
  • 8
  • 15
0

try use android:gravity="end" of Edittext:

like below code

<EditText
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:gravity="end"
     android:hint="@string/app_name" />
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0

try this android:gravity="start" to your Editext

UltimateDevil
  • 2,807
  • 2
  • 18
  • 31
Ramesh Yogu
  • 135
  • 7
0

Try this it will work.

 <EditText
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:gravity="right"
  />
Jason
  • 122
  • 2
  • 11
0

You may add the below line in editText android:textDirection="anyRtl" or for more detail See here

PRIYA PARASHAR
  • 777
  • 4
  • 15
0

If you want to fill EditText from end try below code...

android:gravity="end"

user320676
  • 394
  • 2
  • 19
0

you may use multiple EditTexts with input type of numbers and control focus flow programatically.

SemyColon.Me
  • 378
  • 3
  • 18