Как создать сложную таблицу на Android - PullRequest
0 голосов
/ 03 ноября 2010

это в основном то, чего я хочу достичь: http://i52.tinypic.com/15qelwy.jpg

пока что это мой файл main.xml

<TableLayout
  android:paddingTop="80sp"
  android:paddingLeft="40sp"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <TableRow>
   <TextView
    android:text="@string/questions"
    android:textColor="#000" 
    android:textStyle="bold"
    android:textSize="18dip"
    android:layout_height="100px"
    android:layout_width="100px"/>   
    <ImageButton
     android:id="@+id/button_one"
     android:src="@drawable/button_flat"
     android:layout_width="227px"
     android:background="@null"
     />
    <ImageButton
     android:id="@+id/button_one"
     android:src="@drawable/button_flat"
     android:layout_width="227px"
     android:background="@null"
     />
  </TableRow>
 </TableLayout>

Результат не очень приятный, поскольку он отображает 2-ю кнопку в другом столбце. Как я могу создать только две колонки; первый расширяемый, а следующий столбец содержит несколько кнопок изображений?

спасибо.

1 Ответ

0 голосов
/ 03 ноября 2010

Может как то так?

<?xml version="1.0" encoding="utf-8"?>

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="80sp"
android:paddingLeft="40sp"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TableRow>
  <TextView
    android:text="@string/questions"
    android:textColor="#000" 
    android:textStyle="bold"
    android:textSize="18dip"
    android:layout_height="100px"
    android:layout_width="fill_parent"/>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" >   
        <ImageButton
         android:id="@+id/button_one"
         android:src="@drawable/button_flat"
         android:layout_width="227px"
         android:background="@null"
         />
        <ImageButton
         android:id="@+id/button_one"
         android:src="@drawable/button_flat"
         android:layout_width="227px"
         android:background="@null"
         />
 </LinearLayout>
 </TableRow>
</TableLayout>
...