2014-02-01 3 views
0

Я использую tableLayout, и я хочу установить высоту tableRow как можно выше, чтобы отображать textViews правильно (которые находятся в linearLayout). На данный момент второй textView отображается неправильно (он просто не вписывается в строку). Это XML:Как установить высоту в соответствии с самой высокой колонкой?

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="@color/background"> 

    <TableRow 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/stripe_background" 
     android:gravity="right|center_vertical" 
     android:paddingTop="@dimen/stripe_padding_buttons_top_bottom" 
     android:paddingBottom="@dimen/stripe_padding_buttons_top_bottom" 
     android:paddingLeft="@dimen/stripe_padding_sides" 
     android:paddingRight="@dimen/stripe_padding_sides" 
     android:layout_marginBottom="@dimen/stripe_margin_top_bottom"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:layout_column="0" 
      android:layout_weight="1" 
      android:paddingRight="@dimen/stripe_padding_between_text_views" 
      android:gravity="right|center_vertical"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/settings_text_view_current_consumption_main" 
       android:id="@+id/textViewCurrentConsumptionMain" 
       android:textColor="@color/big_text" 
       android:textSize="@dimen/small_text"/> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/settings_text_view_current_consumption_additional" 
       android:id="@+id/textViewCurrentConsumptionAdditional" 
       android:textColor="@color/small_text"/> 

     </LinearLayout> 

     <CheckBox 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/checkBox" 
      android:layout_column="1" 
      android:button="@drawable/check_box_custom" 
      android:checked="true" /> 
    </TableRow> 
</TableLayout> 

Для того, чтобы сделать мой вопрос яснее, что это проблема в изображении. Во-вторых TextView не отображается должным образом: enter image description here

+1

попробовать Android: layout_height = "wrap_content" для строки таблицы – saopayne

+0

@saopayne не помогло. – user3178137

+0

попробуйте андроид: layout_weight = "2" и дайте каждому текстуру layout_weight из 1 – saopayne

ответ

2

Сделать LinearLayout и все TextView сек Высота до wrap_content (TableRow) также

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