AndroidDev
AndroidDev

Reputation: 4559

Cursor appears at center of EditBox

I have an EditBox in which I set the input type as textMultiLine. The issue is that the cursor in the EditBox always appears at the center of the EditBox, But I want it to display at the top left of my EditBox.

So why this happens?

Code for EditBox

<EditText
    android:id="@+id/notes_edit_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:background="@drawable/img_add_notes_textbox"
    android:inputType="textMultiLine"
    android:maxHeight="30dp"
    android:paddingLeft="15dp"
    android:scrollbars="vertical"
    android:textColor="#121212" >
</EditText>

ScreenShots

enter image description here

Upvotes: 0

Views: 183

Answers (2)

waqaslam
waqaslam

Reputation: 68167

You need to set android:gravity="top|left" to your EditText

Upvotes: 2

user370305
user370305

Reputation: 109237

Because, by default gravity of EditText is center so just set it to top

android:gravity="top"

Upvotes: 4

Related Questions