开发者

Edittext starting point problem Android

开发者 https://www.devze.com 2023-03-26 10:35 出处:网络
In my code,am having EdiText and its code is: <EditText android:layout_height=\"150dp\" android:id=\"@+id/profiledescription\"

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:l开发者_如何学Pythonayout_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:

Edittext starting point problem Android


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


Try specifying the following in your EditText XML declaration:

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

Hope this helps!


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>


Use the following:

android:gravity="top" android:singleLine="false"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号