[英]How to disable scrolling of an item in ListView android
I just want to protect my first item of list view from scrolling or to stick the first item at the top of my layout. 我只是想保护列表视图的第一项免于滚动,或者将第一项粘贴在布局的顶部。 I cannot use other layout for that. 我不能为此使用其他布局。
Remember other elements must be scroll in that list view. 请记住,其他元素必须在该列表视图中滚动。
Can i do that and if yes tell me how ??(with array adapter or custom one or any other method to do that) 我可以这样做吗,如果可以,请告诉我怎么做(使用阵列适配器或自定义一种或任何其他方法来做到这一点)
please help... 请帮忙...
already visited Disable scrolling of a ListView contained within a ScrollView 已经访问过禁止滚动ScrollView中包含的ListView
and Disable scrolling in listview ' 和禁用在列表视图中滚动 '
but it disable whole list view. 但会禁用整个列表视图。
You can use a Header View: 您可以使用标题视图:
mList.addHeaderView(yourFirstItemView);
Remember to inflate "yourFirstItemView", something like: 请记住要为“ yourFirstItemView”充气,例如:
LayoutInflater inflater = getLayoutInflater();
yourFirstItemView = inflater.inflate(R.layout.item, parent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.