2011-09-10 80 views
0

彈出:在縱向模式下,關閉按鈕和邊框線之間的區域不夠寬。表格佈局問題

以肖像模式測試手機。 發送短信或彩信到測試手機。 觀察關閉按鈕和邊框線之間區域的彈出窗口。

實際結果:關閉按鈕和邊框線之間的區域不夠寬。查看 趨勢屏幕截圖 預期結果:關閉按鈕與邊界線之間的區域應類似於按回車鍵 的邊界線。

在橫向模式的情況下不能重新產生..

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#00000000"> 
<RelativeLayout 
      android:layout_height="wrap_content" 
      android:layout_width="300dp"> 
<LinearLayout 
    android:layout_width="300dp" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:layout_gravity="center"> 
    <TextView 
      android:id="@+id/unread_messges_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="5dp" /> 
    <View 
     android:layout_height="1dp" 
     android:layout_width="fill_parent" 
     android:background="@color/background_light" 
     /> 
    <RelativeLayout 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_margin="5dp" 
      > 
      <ImageView 
        android:id="@+id/contact_photo" 
        android:scaleType="centerCrop" 
       android:layout_width="70dp" 
       android:layout_height="70dp" 
       /> 
      <TextView 
       android:id="@+id/sender_name_number" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/contact_photo" 
       android:textSize="20dp" 
       android:singleLine="true" 
       android:layout_marginLeft="5dp" 
       /> 
      <TextView 
       android:id="@+id/message_subject" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/contact_photo" 
       android:layout_below="@+id/sender_name_number" 
       android:textSize="15dp" 
       android:singleLine="true" 
       android:layout_marginLeft="5dp" 
       />  
      <TextView 
       android:id="@+id/message_received_time" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/contact_photo" 
       android:layout_below="@+id/message_subject" 
       android:text="@string/message_received_time" 
       android:layout_marginLeft="5dp" 
       /> 
    </RelativeLayout> 
    <View 
     android:layout_height="1dp" 
     android:layout_width="fill_parent" 
     android:background="@color/background_light" 
     /> 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/message_body_textpart" 
     android:layout_margin="5dp" 
     > 
    </RelativeLayout> 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/message_body_imagepart" 
     android:layout_marginLeft="5dp" 
     android:layout_marginBottom="4dp" 
     android:layout_marginRight="5dp" 
     > 
    </RelativeLayout> 

    <TableLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:background="@color/background_light" 
      android:stretchColumns="*"> 
     <TableRow 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="3dp" 
      > 
     <Button 
      android:text="@string/reply_button_text" 
      android:id="@+id/reply_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"/> 
     <Button 
      android:id="@+id/next_button" 
      android:text="@string/next_button_text" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content"/> 
     <Button 
      android:text="@string/close_button_text" 
      android:id="@+id/close_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      /> 
     </TableRow> 
    </TableLayout> 

</LinearLayout> 
</RelativeLayout> 
</ScrollView> 
+0

您能否詳細說明您的問題 – AB1209

回答

1

我會嘗試一個水平的LinearLayout而不是表查看底部的3個按鈕。將每個按鈕的寬度設置爲0dip並將layout_weight設置爲1.

<LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/background_light"> 
    <Button 
     android:text="@string/reply_button_text" 
     android:id="@+id/reply_button" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="1"/> 
    <Button 
     android:id="@+id/next_button" 
     android:text="@string/next_button_text" 
     android:layout_height="wrap_content" 
     android:layout_width="0dip" 
     android:layout_weight="1"/> 
    <Button 
     android:text="@string/close_button_text" 
     android:id="@+id/close_button" 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     /> 
</LinearLayout> 
0

變化android:layout_marginTop="3dp"從按鈕的TableRowandroid:padding="3dp"

padding is for padding space between layout and its child 

margin is for padding space between layout and its parent