改变的地方光标开始在展开的EditText光标、地方、EditText

由网友(" -假装不去触碰记忆)分享简介:我有一个从它的正常单一线的宽度和高度,但光标到开始输入所述的EditText膨胀的TextField总是处于膨胀文本框的中心时更改文本字段并且那的高度,其中它开始把文本了。我怎样才能得到光标移到左上角像正常的,同时仍保持较大的高度盒子?这是我的盒子是布局<的EditText机器人:ID =@ + ID / edi...

我有一个从它的正常单一线的宽度和高度,但光标到开始输入所述的EditText膨胀的TextField总是处于膨胀文本框的中心时更改文本字段并且那的高度,其中它开始把文本了。

我怎样才能得到光标移到左上角像正常的,同时仍保持较大的高度盒子?

这是我的盒子是布局

 <的EditText
    机器人:ID =@ + ID / editText1
    机器人:layout_width =match_parent
    机器人:layout_height =200dp
    机器人:layout_alignParentLeft =真
    机器人:layout_below =@ + ID / camera_picture
    机器人:layout_marginTop =58dp
    机器人:EMS =10
    机器人:inputType =textMultiLine>

    <不是requestFocus />
< /的EditText>
 

解决方案

其设置在你的XML

机器人:重力=顶

您也可以尝试这种

机器人:重力=顶|左

 <的EditText
    机器人:ID =@ + ID / editText1
    机器人:重力=顶< ----------------
    机器人:layout_width =match_parent
    机器人:layout_height =200dp
    机器人:layout_alignParentLeft =真
    机器人:layout_below =@ + ID / camera_picture
    机器人:layout_marginTop =58dp
    机器人:EMS =10
    机器人:inputType =textMultiLine>

    <不是requestFocus />
< /的EditText>
 
在Word中如何改变光标的位置

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?

this is how my box is layout

<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>

解决方案

set this in your xml

android:gravity="top"

you can also try this

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>

阅读全文

相关推荐

最新文章