2013-04-22 55 views
1

我試圖創建以下觀點:安卓tablelayout溢出

enter image description here

我的XML:

<LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="14dp" 
      android:gravity="center_vertical" 
      android:orientation="horizontal" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/meals_line_shadow_left" /> 

      <TableLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:stretchColumns="0" > 

       <TableRow 
        android:layout_width="wrap_content" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center_horizontal" 
        android:orientation="horizontal" > 

        <TextView 
         android:id="@+id/textDate" 
         style="@style/MealWizard.BigText" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:gravity="center" 
         android:text="text" 
         android:textSize="16sp" /> 

        <ImageButton 
         android:id="@+id/buttonDatePicker" 
         android:layout_width="wrap_content" 
         android:layout_height="match_parent" 
         android:paddingRight="7dp" 
         android:paddingLeft="7dp" 
         android:background="@null" 
         android:src="@drawable/general_date_button_selector" /> 
       </TableRow> 

       <TableRow 
        android:layout_width="wrap_content" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center_horizontal" 
        android:orientation="horizontal" > 

        <TextView 
         android:id="@+id/textTime" 
         style="@style/MealWizard.BigText" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:gravity="center" 
         android:text="15:34" 
         android:textSize="24sp" /> 

        <ImageButton 
         android:id="@+id/buttonTimePicker" 
         android:layout_width="wrap_content" 
         android:layout_height="match_parent" 
         android:paddingRight="7dp" 
         android:paddingLeft="7dp" 
         android:background="@null" 
         android:src="@drawable/general_time_button_selector" /> 
       </TableRow> 
      </TableLayout> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/meals_line_shadow_right" /> 
     </LinearLayout> 

的問題是,我沒有看到正確的ImageView:

enter image description here

我需要解決這個問題,而不使用絕對大小(它與絕對值一起工作)。

我會很樂意爲固定任何建議或替代

回答

0

解決方法很簡單:

<TableLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_weight="1" 
       android:stretchColumns="0" >