Is there anyway to make an EditText start typing at the top left corner of the EditText?

AndroidAndroid EdittextCenterTyping

Android Problem Overview


I have an EditText with the property:

android:minLines="3"

However, when I start typing, it types in the middle of the EditText.

Is there any way to get this to start typing at the top left of the EditText area?

Android Solutions


Solution 1 - Android

Add android:gravity="top|left" to the EditText in the layout XML file.

Solution 2 - Android

Just insert

android:gravity="top"

into your EditText.

Solution 3 - Android

android:gravity="start" would put it to the top left.

Solution 4 - Android

This will help you. Try this EditText....

<EditText
    android:id="@+id/edt_comment_note"
    android:layout_width="fill_parent"
    android:layout_height="60dp"
    android:background="@drawable/white_box"
    android:gravity="top"
    android:hint="Note"
    android:imeOptions="actionDone"
    android:maxLines="3"
    android:padding="5dp"
    android:textSize="15sp" />

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNotACleverManView Question on Stackoverflow
Solution 1 - AndroidCommonsWareView Answer on Stackoverflow
Solution 2 - AndroidMainly KarmaView Answer on Stackoverflow
Solution 3 - Androiduser8290605View Answer on Stackoverflow
Solution 4 - AndroidMitul GotiView Answer on Stackoverflow