11

私はこれを持っていますEditText

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine"
        android:lines="5"
        android:singleLine="false"
        android:text="@string/app_name" />

</LinearLayout>

私の問題は、入力が EditText の途中から始まることです。

私の質問は、EditText の左上で入力を開始する方法ですか?

4

3 に答える 3

24

android:gravity="top" あなたのコードが次のようになるようにしてください:

<EditText
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:gravity="top"
     android:inputType="textMultiLine"
     android:lines="5"
     android:singleLine="false"
     android:text="@string/app_name" />
于 2013-04-06T13:05:15.260 に答える
4

うまくいくはずだと思います。

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:inputType="textMultiLine"
    android:lines="5"
    android:singleLine="false"
    android:gravity="top|left"
    android:text="@string/app_name" />
于 2013-04-06T13:08:33.037 に答える