禁用滚动查看ScrollView中包含的ListView [英] Disable scrolling of a ListView contained within a ScrollView

查看:60
本文介绍了禁用滚动查看ScrollView中包含的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的用户显示一个个人资料"屏幕.

I want to show a Profile screen for my users.

它必须具有三个视图(2个Buttons和一个ImageView)和一个ListView才能显示该用户制作的内容.

It must have three views (2 Buttons and a ImageView) and a ListView to show the content made by that user.

但是,我不希望ListView滚动.相反,我希望它尽可能大,并将所有视图放入ScrollView内,以便使用ListView滚动出前三个视图.当然,这不能按预期工作.

However, I don't want the ListView to scroll. Instead, I want it to be as big as needed, and to put all my views inside a ScrollView, so the three first views scroll out with the ListView. This, of course, does not work as intended.

我的所有三个物品都放在LinearLayout内.我曾想过将它们作为ListView中的第一项,但是这导致它们可以被选作第一项,并且不得不进行一些不必要的编码.

All my three items are inside a LinearLayout. I thought of making them the first item in the ListView, but this leads to them being selectable as the first item, and having to do some unneeded coding.

有没有一种简便的方法,还是我必须坚持将Layout设置为ListView中的第一项?

Is there a way to do this the easy way or will I have to stick with making the Layout the first item in my ListView?

推荐答案

将它们作为第一项添加到ListView似乎是一个很好的解决方案.

Adding them to the ListView as first Item seems like a pretty good solution.

要取消选择视图,只需获取视图和.setClickable(false).

To make the View unselectable just get the view and .setClickable(false).

这篇关于禁用滚动查看ScrollView中包含的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆