首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >android表格布局行table

android表格布局行table
EN

Stack Overflow用户
提问于 2010-02-03 13:55:44
回答 3查看 46.6K关注 0票数 18

我想要建立以下布局,但它不工作。

alt text http://toms-toy.de/rowspan.gif

代码语言:javascript
复制
<LinearLayout android:orientation="horizontal"...>
  <ImageView ...></ImageView>
        <TableLayout ...>
                        <TableRow..>
                              <ImageView ...></ImageView>
                              <ImageView ...></ImageView>
                              <ImageView ...></ImageView>
                        </TableRow>
                         <TableRow..>
                              <ImageView ...></ImageView>
                              <ImageView ...></ImageView>
                              <ImageView ...></ImageView>
                        </TableRow>
       </TableLayout>
  <ImageView ...></ImageView>
</LinearLayout>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2010-02-03 17:20:47

我很快就把它们组合在一起了,试试这个:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
    <ImageView android:layout_width="50dip" android:layout_height="100dip" android:background="#cc0000"/>
    <TableLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
        <TableRow>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#aaaa00"/>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#00aa00"/>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#aaaa00"/>
        </TableRow>
        <TableRow>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#00aa00"/>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#aaaa00"/>
            <ImageView android:layout_width="50dip" android:layout_height="50dip" android:background="#00aa00"/>
        </TableRow>
    </TableLayout>
    <ImageView android:layout_width="50dip" android:layout_height="100dip" android:background="#cc0000"/>
</LinearLayout>
票数 34
EN

Stack Overflow用户

发布于 2011-11-09 11:57:42

试试这个:

代码语言:javascript
复制
<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TableRow>
        <TextView android:text="1-2, 1;\t" android:layout_gravity="center" />
        <TableLayout>
            <TableRow>
                <TextView android:text="1, 2;\t" android:layout_gravity="center" />
            </TableRow>
            <TableRow>
                <TextView android:text="2, 2;\t" android:layout_gravity="center" />
            </TableRow>
        </TableLayout>
    </TableRow>
</TableLayout>
票数 7
EN

Stack Overflow用户

发布于 2018-08-22 21:02:06

以下代码的输出

默认情况下,android没有任何名为rowspan的属性,但下面的代码运行良好,并创建了行跨度。

代码语言:javascript
复制
<TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
    <TableRow>
        <TextView
            android:text="Hello"
            android:textSize="30dp"
            />
        <TextView
            android:text="Hello World"
            android:textSize="30dp"
            android:background="@drawable/border"

            />
        <Button android:text="Click me"
            android:textSize="30dp"/>

    </TableRow>

    <TableRow>
        <TextView
            android:text="Hello"
            android:textSize="30dp"
            />
           <Button android:text="Click"
            android:textSize="30dp"
               android:layout_column="2"/>

    </TableRow>
    <TableRow>
        <TextView
            android:text="Hello"
            android:textSize="30dp"
            />
        <TextView
            android:text="Hello"
            android:textSize="30dp"
            />
        <Button android:text="Click me"
            android:textSize="30dp"/>

    </TableRow>
    <TableRow>
        <TableLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:layout_span="2">
            <TableRow>
                <Button android:text="1"/>
                <Button android:text="2"/>
            </TableRow>
            <TableRow>
                <Button android:text="3"/>
                <Button android:text="4"/>
            </TableRow>

        </TableLayout>
        <Button
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:text="Enter"
            android:background="#ff0099"/>
    </TableRow>
</TableLayout>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2189986

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档