Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to make an EditText start typing at the top left corner of the EditText?

I have an EditText with the property:

android:minLines="3" 

However, when I start typing, it types in the middle of the EditText.

Is there any way to get this to start typing at the top left of the EditText area?

like image 731
NotACleverMan Avatar asked May 05 '11 11:05

NotACleverMan


People also ask

How do I change the cursor position in EditText?

Say in your xml's edittext section, add android:paddingLeft="100dp" This will move your start position of cursor 100dp right from left end. Same way, you can use android:paddingRight="100dp" This will move your end position of cursor 100dp left from right end.

How do you make EditText not editable and clickable?

For the above requirement the solution in XML is android:editable="false" but I want to use this in Java. et. setKeyListener(null); It makes the EditText not EDITABLE but at the same time it makes it non clickable as well.

How do I scroll up layout when clicking on EditText?

try this android:windowSoftInputMode="adjustResize" in your activity in manifest file.


2 Answers

Add android:gravity="top|left" to the EditText in the layout XML file.

like image 192
CommonsWare Avatar answered Sep 18 '22 22:09

CommonsWare


Just insert

android:gravity="top" 

into your EditText.

like image 20
Mainly Karma Avatar answered Sep 17 '22 22:09

Mainly Karma