簡體   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