我有ListView
,我想隱藏一些項目,我用view.setVisibility(View.INVISIBLE)
它運行良好,但是當ListView
有很多項目和我滾動然後幾個項目後,再次是隱形項目。Android隱形ListView項目
適配器:
public void setIndexHidenItem(int index){
indexHidenItem = index;
}
public View getView(final int index, View view, ViewGroup group) {
if (view == null) {
view = LayoutInflater.from(mainContext).inflate(R.layout.hlist_item_template, null);
}
更改公開:
if (indexHidenItem != -1){
if (index == indexHidenItem){
if (view.getVisibility() == View.VISIBLE) {
view.setVisibility(View.INVISIBLE);
}
}else{
if (view.getVisibility() == View.INVISIBLE){
view.setVisibility(View.VISIBLE);
}
}
}
謝謝,它的工作=) – Aleksandr