【问题标题】:How to create ScrollView to cover 2 TableLayout?如何创建 ScrollView 以覆盖 2 TableLayout?
【发布时间】:2012-04-09 05:12:02
【问题描述】:

我知道 ScrollView 只能有一个 Child,但在我的情况下,我需要有 2 个 TableLayout 使用相同的滚动。我确实尝试过使用 LayoutView wrap 2 TableLayout inside,如下例所示......但它只显示第一个 TableLayout 中的视图

   <ScrollView 
       android:layout_width="match_parent"
       android:layout_height="wrap_content">
       <LinearLayout 
           android:layout_width="match_parent"
           android:layout_height="wrap_content">
           <TableLayout
               android:layout_width="match_parent" 
               android:layout_height="wrap_content">
               //...
           </TableLayout>
           <TableLayout
               android:layout_width="match_parent" 
               android:layout_height="wrap_content">
               //...
           </TableLayout>
       </LinearLayout>
   </ScrollView>

【问题讨论】:

    标签: android scrollview tablelayout


    【解决方案1】:

    看起来你想要一个垂直滚动的列表。包装这两个表应该可以,但 LinearLayout 默认为水平方向。所以将android:orientation="vertical"添加到包装LinearLayout

    【讨论】:

    • @AliSh 起初我尝试接受,但有一个警告对话框“你可以在 9 分钟后接受这个问题”所以我出去吃晚饭对不起.. 迟到了接受
    猜你喜欢
    • 2017-01-06
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    • 1970-01-01
    • 2014-08-05
    • 1970-01-01
    • 1970-01-01
    • 2014-04-01
    相关资源
    最近更新 更多