[英]Android custom expandable listview expands every nth item
我有使用ViewHolder的自定義listview和數組適配器。 單擊listview項目時,它將在下面展開新的布局。 問題是:不幸的是,它在列表視圖中的第+9個項目中都打開了。 0,9,18th個元素打開其展開布局。 有沒有看代碼的想法嗎?
我不知道,但這聽起來像我遇到的一個問題。 我有一個帶有TextView
對象的listview,並且選擇了多個並且輸入了相同的值。
為此,我做了一個非常非常骯臟的修復程序,無論如何,我始終會創建一個新的View:
@Override
public View getView (final int position, View convertView, final ViewGroup parent) {
//if (convertView == null) {
// Inflate the view from the converter
final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
convertView = layoutInflater.inflate(converter.getLayout(), parent, false);
//}
// Populate the view from the converter
converter.populateInflatedView(convertView, getItem(position));
return convertView;
}
附帶說明一下,我為TreeView創建了某種接口類型的事物,但是它處於Activity
形式,使用ScrollView
。 因此,這實際上不是ListView類型的交易,但可能會對您有所幫助。 可以在Tree-link上找到Tree部分,並在主題包中找到一個實現。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.