How to align EditText cursor properly?
I have an edit text with a 200sp size. The cursor appears in the middle. How can I make sure the 开发者_如何学Ccursor appears in the left corner? It looks odd being in the center.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/composeEditText" android:minHeight="200sp" android:focusable="true" android:hint="Share an idea with the community"></EditText>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/toolbarLinearLayout">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/sendButton" android:text="Send"></Button>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/shortenButton" android:text="Shorten"></Button>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/charCountTextView" android:text="140"></TextView>
</LinearLayout>
</LinearLayout>
Use android:gravity="top|left"
http://developer.android.com/reference/android/widget/TextView.html#attr_android:gravity
You should use gravity
attribute:
<EditText android:gravity="left|bottom" ... />
I know it's an old post,possibly it wasn't relevant then... now we use android:gravity="top|start" or android:gravity="bottom|start"
so it will match it to the locale.
精彩评论