简体   繁体   English

在Android开发中是否可以使用ScrollView在LinearLayout中添加多个TableLayout?

[英]Is it possible to add more than one TableLayout in a LinearLayout with a ScrollView in Android development?

I have this nice android app made up and was going to add in some finishing touches, one of which includes a page with two tables, and found that I can't make it happen. 我组成了这个漂亮的android应用程序,打算添加一些画龙点睛的内容,其中之一包括一个包含两个表的页面,结果发现我做不到。 Basically I am trying to make a table with some values (across 4 or 5 columns) and then make another table below of different values (with only 2 columns). 基本上,我试图制作一个带有某些值的表(跨4或5列),然后在下面制作另一个表的不同值(仅2列)。 The tables will exceed the screen so it needs a ScrollView. 表格将超出屏幕,因此需要ScrollView。 However when I put all this together I get an error: ScrollView can host only one direct child. 但是,当我将所有这些放在一起时,会出现一个错误:ScrollView只能容纳一个直接子代。 I have tried putting it in a LinearLayout. 我试过将其放在LinearLayout中。 That does nothing either. 那什么也没做。 I 一世

yes you can use more TableLayout but you need only one parent layout in the scrollview 是的,您可以使用更多的TableLayout,但是在滚动视图中只需要一个父布局

<Scrollview>
      <LinearLayout> //parent layout
          <TableLayout>
           <TableRow></TableRow>
            </TableLayout>
           <TableLayout>
          <TableLayout>
         </TableLayout>
        </TableLayout>
     <LinearLayout>
<Scrollview>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM