1

這是我的佈局設置文本框的大小與wrapcontent

<LinearLayout android:orientation="vertical" 
     android:layout_height="wrap_content" android:layout_below="@id/checkBox_block_all" 
     android:id="@+id/linearLayout_addtoblack" android:layout_width="fill_parent"> 
     <LinearLayout android:id="@+id/linearLayout2" 
      android:layout_width="match_parent" android:layout_height="wrap_content" 
      android:gravity="center"> 
      <LinearLayout android:id="@+id/linearLayout3" 
       android:layout_width="wrap_content" android:layout_height="match_parent" 
       android:orientation="vertical" android:layout_weight="1"> 
       <TextView android:id="@+id/textView1" 
        android:layout_height="wrap_content" android:text="Enter the full number" 
        android:layout_width="fill_parent"></TextView> 
       <EditText android:layout_width="match_parent" 
        android:layout_height="wrap_content" android:id="@+id/editText1" 
        android:textSize="18sp"> 
        <requestFocus></requestFocus> 
       </EditText> 
      </LinearLayout> 
      <Button android:layout_width="wrap_content" 
       android:layout_height="wrap_content" android:id="@+id/button_add" 
       android:text="Add to black list" android:layout_weight="1"></Button> 
     </LinearLayout> 
    </LinearLayout> 

的一部分,這是它的樣子

enter image description here

圖像的點是我想要的文本框爲了更大,我使用wrap_parent值來設置高度,我期望文本框足夠大,但不是那樣,文本框就像你看到的那樣不知何故裁剪過,我不知道爲什麼,任何幫助,建議,任何東西?,我不想設定固定價值爲文本框

+0

您是否嘗試過使用線性佈局中的layout_weight值? – 2012-01-09 16:26:58

回答

0

您按鈕被限制高度,所以要麼你可以使按鈕的layout_hieght匹配,父母或如果看起來很奇怪,投入的LinearLayout按鈕,使新的LinearLayout的高度match_parent

但我認爲最好的辦法是使用一個RelativeLayout並具有相同佈局的所有3個視圖

2

的高度,在「添加到黑名單」按鈕ES,改變layout_height爲「FILL_PARENT」

該按鈕使的EditText小,因爲他們的底線是一字排開