简体   繁体   English

如何使ListView和其他小部件整体滚动

[英]How to make ListView and other widgets scroll as a whole

Iam have a layout like the below 我的布局如下

    --scrollview--
    --linearlayout--
    --TextView--
    --TextView--
    --TextView--
    --TextView--
    --TextView--   
--edittext--
--edittext--
--edittext--
--edittext--
   --TextView--
   --listview--
--linearlayout--
--scrollview--

list view is scrolling seperatly with inner scroll, How to make the whole layout scroll with out list view inner scroll. 列表视图与内部滚动分别滚动,如何使整个布局在没有列表视图内部滚动的情况下滚动。

You should not have a ListView inside a ScrollView . 您不应在ScrollView拥有ListView This is highly discouraged. 不鼓励这样做。 Try to find another way to build the layout you want. 尝试找到另一种构建所需布局的方法。

It defeats the purpose of listView, when you want to disable scroll inside it. 当您要禁用列表内滚动时,它违反了listView的目的。 I would suggest you to inflate the views of your listView inside a vertical LinearLayout if you want to scroll it as a part of scrollView. 我建议您在垂直的LinearLayout中增加listView的视图,如果您希望将其作为scrollView的一部分进行滚动。

Please change LinearLayout to RelativeLayout and see. 请将LinearLayout更改为RelativeLayout然后查看。 I too had this same issue once. 我也曾经有过同样的问题。 It solved my issue too. 它也解决了我的问题。

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

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