繁体   English   中英

滚动查看多个LinearLayouts

[英]Scrollview multiple LinearLayouts

所以我有多个linearlayouts(4),我希望将它们全部放在scrollview 这些布局用于按列/类别Names, Ages, Occupation, and Country of Residence分隔的输入字段。

其中的每一个都有自己的linearlayout 有没有办法让它们全部同时滚动(因为scrollview只支持1个孩子)?

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

来自Docs

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

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

ScrollView只能有一个直接子代

因此请使用一个将包含您所有布局的布局

喜欢

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

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

</LinearLayout>
</ScrollView>

你必须花时间一次做一个。 正如Tarsem所说,你可以在这个scrollview中放置一个布局

<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>
<ScrollView 
   <LinearLayout     // Your Main Layout 
       <LinearLayout   // Child Layout 1st
       </LinearLayout>

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

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

   </LinearLayout>
</ScrollView>

尝试使用关于格式。

希望能帮助到你。

问候

暂无
暂无

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

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