Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing where cursor starts in an expanded 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?

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>
like image 358
tyczj Avatar asked May 01 '12 14:05

tyczj


1 Answers

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>
like image 156
MAC Avatar answered Oct 16 '22 20:10

MAC