2011-02-10 3 views
0

следующий макет Android - это настраиваемая строка для моей активности. Второе текстовое представление в tablerow не растягивается, чтобы соответствовать столбцу, как я хочу. Обратите внимание, что есть только один таблеток, потому что я взял остальных для краткости.андроид настольный выпуск

<?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="wrap_content" 
    android:padding="6dip"> 
    <ImageView 
     android:id="@+id/DocTypeIcon" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/icon" 
     android:layout_gravity="center_vertical" /> 

    <TableLayout 
     android:id="@+id/tableLayout1" 
     android:layout_toRightOf="@id/DocTypeIcon" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:stretchColumns="1"> 

     <TableRow 
      android:id="@+id/tableRow1" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 
       <TextView 
        android:id="@+id/textView1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Pages" 
        android:textStyle="bold" 
        android:layout_marginRight="10dp" /> 
       <TextView 
        android:id="@+id/DynamicTextHere" 
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent" /> 

     </TableRow> 

     <!-- Other rows stripped for brevity --> 

    </TableLayout> 

</RelativeLayout> 

Когда я поставил stretchColumns = «1», я не вижу ничего, кроме пары артефактов на экране. Когда stretchColumns нет, макет только подходит к фиксированной ширине. Я верю, что это может быть RelativeLayout. Тем не менее, это более радикальное изменение, чем я хочу. Могу ли я сделать что-то маленькое, чтобы этот ряд соответствовал моему экрану (как портретному, так и пейзажному)?

ответ

1

Вы можете попробовать: android: stretchColumns = "*"

Смежные вопросы