/ /上部のEditTextウィジェット内にテキストを配置する方法 - アンドロイド、アンドロイドウィジェット

EditTextウィジェット内のテキストを一番上に置くにはどうしたらいいですか? - アンドロイド、アンドロイドウィジェット

私はedittextのために以下のxmlを持っています、そして画面全体を撮影するボタン。唯一の問題は、edittext内の入力されたテキストを一番上に置く方法を見つけることができないことです。今はeditTextの中央に置くことにしました。

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/herinnering_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent">



<EditText
android:id="@+id/invoerTekst"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:hint="@string/prompt_tekst" />

<Button
android:id="@+id/klaar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/action_sla_op"
android:background="@drawable/main_button_over"
android:textColor="#ffffff"
android:layout_margin="5dip"
android:layout_below="@id/invoerTekst" />



</LinearLayout>

回答:

回答№1の22

追加 android:gravity="top" あなたの属性 EditText.


回答№2については4

これを使用してください、それはあなたを助けます。

EditText

    android:id="@+id/invoerTekst"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="@string/prompt_tekst"