Hello! Tell me how you can hide a particular line in the listview. But you need to hide, not when the adapter is filling, but at any other time. For example, by clicking on a certain button, the line was hidden. And hiding so that she disappeared, and not so that the line was, but it is empty.
3 answers
Create a custom adapter that returns a zero-height item in getView()
- I'll try well - RomkaKraynov
- and if view.setVisible (View.GONE); ? - Gorets
- @Gorets And how do you catch this view?
getView()is not called by you ... - Barmaley - "@Gorets And how do you catch this view? GetView () is not called by you ..." I completely agree with you, so I began to do it differently. - RomkaKraynov
|
In short, I solved the problem in a slightly different way. I just deleted the N line from my ArrayList and then the adapter called the notifyDataSetChanged () method and everything became normal)
- Well, this is not interesting, it is called not to hide the string, but to remove the string from the collection. You have already been asked:> As I understand it, by hiding a string is meant to remove an item from> ListView, but leave it in the collection? - Barmaley
- :-))))) I understand that it is not interesting)) - RomkaKraynov
- @RomkaKraynov, in the layout for the adapter you create the
layoutand givelayout.id. In the adapter, by clicking on a button, you hide this layout,layout.setVisibility.(View.GONE), you find the position by the position of the pressed button. This is to hide the list line - zayn1991
|
In the layout for the adapter, you create the layout and give layout.id . There you place all the elements of the template. In the adapter, by clicking on a button, you hide this layout, layout.setVisibility.(View.GONE) , you find the position by the position of the pressed button. This is to hide the list line
|