简体   繁体   English

阻止所有项目,但ListView中的第一个元素除外

[英]Block all items, except the first element in ListView

I want to create a ListView with particular elements. 我想创建一个具有特定元素的ListView。 But when the listview shows for the 1st time, 1 only enabled the first element and the rest blocked. 但是,当列表视图第一次显示时,1仅启用第一个元素,其余元素被阻止。 I tried to block the list and later listView.getChildAt(0).setEnabled(true). 我试图阻止列表,然后阻止listView.getChildAt(0).setEnabled(true)。 But Nothing happens. 但是什么也没发生。

Can't you just use an id property of the object on the adapter. 您不能只在适配器上使用对象的id属性。 I assume that you hold your data on an array. 我假设您将数据保存在一个数组中。 When you inflate the view, if the index on the array is 0, then set the property setEnabled to true, or else setEnabled to false. 扩展视图时,如果数组的索引为0,则将属性setEnabled设置为true,否则将setEnabled设置为false。

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

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