Alternative of gravity property in relativr layout to align contents of edit text right

70 views Asked by At

I tried to align the text inside my edit text right but I don't want to use gravity as gravity property (I don't know why) hiding my edit text when softkeypad appears. So, is there any alternative to gravity and of course layout gravity property for edit text?

2

There are 2 answers

0
TheScarecrow On

If you're using a Horizontal Linear Layout, you can try adding:

<View
   android:layout_width="0dp"
   android:layout_height="0dp"
   android:layout_weight="1"/>

just before the edittext.

1
Yevgeny Simkin On

Sounds to me like your problem is that you don't want the keyboard to cover your EditText. I would leave the gravity alone (since that's the correct way to align the text inside the field) and consult this answer on how to protect from having the keyboard obstruct your field.