Android: Vertical alignment for multi line EditTex

2019-01-12 17:17发布

I want to have 5 lines for the height of the text area. I am using the following code.

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:singleLine="false"
    android:lines="5"
    android:layout_marginLeft="10dip"
    android:layout_marginRight="10dip" />

The text area looks fine, but the problem is that the cursor is blinking in the middle of the text field. I want it to blink at first line, at the first character of the text field.

7条回答
Juvenile、少年°
2楼-- · 2019-01-12 18:04

Use android:gravity="top"

查看更多
登录 后发表回答