本文介紹了更改光標在展開的 EditText 中的開始位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我的 TextField 從其正常的單行寬度和高度擴展,但是當我更改文本字段的高度時,開始在 EditText 中輸入的光標始終位于擴展文本字段的中心,這就是它開始放置文本的位置也是.
I have TextField that is expanded from its normal single line width and height but the cursor to start typing in the EditText is always in the center of the expanded textfield when I change the height of the textfield and thats where it starts putting text too.
我怎樣才能像往常一樣將光標移到左上角,同時仍然保持更大的高度框?
How can I get the cursor to the top left corner like normal while still keeping a bigger height box?
這就是我的盒子的布局
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/camera_picture"
android:layout_marginTop="58dp"
android:ems="10"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
推薦答案
在你的xml中設置這個
set this in your xml
android:gravity="top"
你也可以試試這個
android:gravity="top | left"
<EditText
android:id="@+id/editText1"
android:gravity="top" <----------------
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/camera_picture"
android:layout_marginTop="58dp"
android:ems="10"
android:inputType="textMultiLine" >
<requestFocus />
</EditText>
這篇關于更改光標在展開的 EditText 中的開始位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!