本文介绍了更改光标在展开的 EditText 中的开始位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我的 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 中的开始位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)