How to hide an item in a listview in Android

后端 未结 11 1068
天涯浪人
天涯浪人 2020-12-03 07:15

I know, this question was asked before, but I haven\'t seen a working answer for it.

Is there any way to hide some items in a ListView without changing

11条回答
  •  鱼传尺愫
    2020-12-03 07:35

    I have a CursorAdapter that can't be modified with backing array, because checking whether item should be shown or not was after getting result from database. I've implemented solution in bindView(View v, Context context, Cursor c) in similar method as was described in other posts. I think that the best way is overriding bindView() method rather then getView(int position, View convertView, ViewGroup parent) because you should carry about null-ckecking for convertView in getView().
    The second thing: I've tried to hide View v in bindView(View v, Context context, Cursor c) and it doesn't worked. After investigation I have figured out that I have to hide each element in view (including layouts that contain your texts, images and etc.)

提交回复
热议问题