2011-04-27 111 views
0

我試圖放置兩個組件。第一個(Edittext)應該展開到下一個組件(一個提交按鈕)。我該怎麼做呢?我的XML如下... 的問題是,EDITTEXT擴展到填滿整個屏幕和隱藏的按鈕:相對佈局的問題

<?xml version="1.0" encoding="utf-8"?> 

<EditText 
      android:id="@+id/etFeedBackText" 
      android:hint="What do you think of this app? Any comments or suggestions?" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_alignBottom="@id/btnFeedBackSubmit"    
      >  
</EditText> 

<Button 
    android:id="@+id/btnFeedBackSubmit" 
    android:text="Submit" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/etFeedBackText" 
    android:layout_alignParentBottom="true" 
    > 

回答

0

把按鈕聲明高於EditText,並在EditText屬性中設置: android:layout_above="@id/btnFeedBackSubmit"

0

刪除此行

android:layout_alignBottom="@id/btnFeedBackSubmit" 
0

試試這個

<EditText 
      android:id="@+id/etFeedBackText" 
      android:hint="What do you think of this app? Any comments or suggestions?" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_above="@id/btnFeedBackSubmit"    
      >  
</EditText> 

<Button 
    android:id="@+id/btnFeedBackSubmit" 
    android:text="Submit" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    > 
0
<EditText 
      android:id="@+id/etFeedBackText" 
      android:hint="What do you think of this app? Any comments or suggestions?" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
    XXXXXXXX remove this  android:layout_alignBottom="@id/btnFeedBackSubmit" 
    XXXXXXXX write this  android:layout_above="@id/btnFeedBackSubmit"   
      >  
</EditText> 
0
<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<Button 
    android:id="@+id/btnFeedBackSubmit" 
    android:text="Submit" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" /> 
<EditText 
    android:id="@+id/etFeedBackText" 
    android:hint="What do you think of this app? Any comments or suggestions?" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_above="@id/btnFeedBackSubmit" />  
</RelativeLayout> 
+0

□是!有效 !! – SaK 2011-04-27 12:37:35