Android set View.GONE does not “release” space in listview

前端 未结 7 556
[愿得一人]
[愿得一人] 2021-01-18 11:01

I have a listview with some items that can be marked as \"done\". There is also a togglebutton that says \"hide done items\".

However, when I do hide the items by s

7条回答
  •  醉话见心
    2021-01-18 11:46

    convertView = inflater.inflate(R.layout.custom_layout, parent, false);
    
    if (CONDITION) {
        holder.wholeLayout.getLayoutParams().height = 1; // visibility Gone not working && 0 height crash app.
    } else {
        holder.wholeLayout.getLayoutParams().height = RelativeLayout.LayoutParams.WRAP_CONTENT;
    }
    

提交回复
热议问题