2

所以我有多个线性布局(4),我想把它们都放在一个scrollview. 这些布局用于由 column/category 分隔的输入字段Names, Ages, Occupation, and Country of Residence

这些中的每一个都有自己的linearlayout. 有没有办法让它们同时滚动(因为滚动视图只支持 1 个孩子)?

4

4 回答 4

4

只要有一个LinearLayout包含所有其他LInearLayouts

来自文档

...意味着您应该在其中放置一个包含要滚动的全部内容的孩子;这个孩子本身可能是一个具有复杂对象层次结构的布局管理器

这意味着它只能有一个直接孩子(主要LinearLayout),但一个孩子可以有自己的孩子。

于 2013-08-22T18:22:27.317 回答
2

ScrollView只能有一个直系子女

所以使用一个包含所有布局的布局

喜欢

<ScrollView  .....>
<LinearLayout .....>

   .............Your All other Layouts .................

</LinearLayout>
</ScrollView>
于 2013-08-22T18:22:11.017 回答
1

你必须慢慢来,一次做一个。正如 Tarsem 所说,您可以在此滚动视图中放置一个布局

<ScrollView  .....>
<LinearLayout .....>
      //Inside this layout, you can another scroll view.
           <ScrollView  .....>
              <LinearLayout .....>

                       .............All your other Layouts .................
                     //continue adding them until you add your last scroll view.  if that 
                      is the desire layout.
                </LinearLayout>
             </ScrollView>

</LinearLayout>
</ScrollView>
于 2013-08-22T18:36:10.747 回答
0
<ScrollView 
   <LinearLayout     // Your Main Layout 
       <LinearLayout   // Child Layout 1st
       </LinearLayout>

       <LinearLayout   // Child Layout 2nd
       </LinearLayout>

       <LinearLayout   // Child Layout 3rd
       </LinearLayout>

   </LinearLayout>
</ScrollView>

尝试使用 about 格式。

希望能帮助到你。

问候

于 2016-08-19T04:44:16.373 回答