2011-04-29 5 views
11

전체 화면을 취하는 edittext 및 버튼에 대해 다음 xml을가집니다. 유일한 문제는 edittext의 입력 된 텍스트를 맨 위에 놓을 수있는 방법을 찾을 수 없다는 것입니다. 지금은 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> 

답변

22

EditTextandroid:gravity="top" 속성을 추가하십시오.

4

사용하면 도움이됩니다.

글고

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" 
관련 문제