Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edittext starting point problem Android

In my code,am having EdiText and its code is:

<EditText 
  android:layout_height="150dp" 
  android:id="@+id/profiledescription"
  android:imeOptions="actionDone|flagNoExtractUi"

  android:textSize="16sp"
  android:paddingLeft="20dp"
  android:layout_width="fill_parent"
   android:enabled="false"



  android:layout_marginRight="20dp"></EditText>

But the problem is cursor is starting from middle rather than usual first position:

Editext cursor

like image 222
Udaykiran Avatar asked Aug 04 '11 16:08

Udaykiran


3 Answers

You'll probably need to set android:gravity="top" for the corresponding XML-element in the layout.

like image 85
karllindmark Avatar answered Oct 04 '22 04:10

karllindmark


Try specifying the following in your EditText XML declaration:

<EditText android:gravity="left|top" ... />

Hope this helps!

like image 22
Codeman Avatar answered Oct 04 '22 04:10

Codeman


You need to add android:gravity="top" to the layout for that EditText.

<EditText 
  android:layout_height="150dp" 
  android:id="@+id/profiledescription"
  android:imeOptions="actionDone|flagNoExtractUi"
  android:gravity="top"
  android:textSize="16sp"
  android:paddingLeft="20dp"
  android:layout_width="fill_parent"
  android:enabled="false"
  android:layout_marginRight="20dp">
</EditText>
like image 27
Phil Avatar answered Oct 04 '22 04:10

Phil