【问题标题】:GridLayout or TableLayout with item over 2 cellsGridLayout 或 TableLayout 项目超过 2 个单元格
【发布时间】:2015-07-24 17:26:57
【问题描述】:

我必须做一个看起来像网格但一个项目(在我的示例中为红色)超过 2 个单元格的特定布局。例子胜于文字,所以布局应该是这样的:

我在 GridLayout 和 TableLayout 周围搜索,但没有找到任何关于如何制作的线索。如果有人知道是否可以使用这样的布局来做到这一点,那将对我有很大帮助。

或者至少如果没有使用这些布局的解决方案,有人可以指导我使用另一个解决方案吗?

提前感谢您的回答!

【问题讨论】:

    标签: android android-layout android-tablelayout android-gridlayout


    【解决方案1】:

    Sample for you problem

    添加 android:layout_span="3" 以跨越 3 列。例如:

    <TableRow>
                    <Button android:id="@+id/item_id"
                        android:layout_span="2"
                        android:layout_width="wrap_content" 
                        android:layout_height="wrap_content" 
                        android:text="item text" />     
                </TableRow>
    

    Video tutorial for Grid

    Insert view to GridLayout dynamically, with even width and height

    Custom GridLayout

    【讨论】:

    • 感谢您的帮助,但这并不是我所期望的,我不想跨越列,而是在其中 2 个列之间添加一个项目。
    猜你喜欢
    • 2013-04-18
    • 2012-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-15
    • 2012-07-25
    相关资源
    最近更新 更多