There is a GridLayoutManager and I want to click on any item to hide everything except the horizontal line in which the item is located. It should look like this.
Any ideas on how to do this?
There is a GridLayoutManager and I want to click on any item to hide everything except the horizontal line in which the item is located. It should look like this.
Any ideas on how to do this?
How can I find the line number in which item was clicked
GridLayoutManager takes the number of columns. Depending on the number of columns and the position of the element, you can calculate which line it is in:
int row = position / columnCount; And how to hide all lines except this one.
In the onBindViewHolder() adapter method, calculate the line number in which this item is located.
Then compare it with the line number of the clicked item, and if they do not match, then hide all the View in the item.
Source: https://ru.stackoverflow.com/questions/579459/
All Articles
notifyDataSetChanged(), and when redrawing, check if the item is in the right row, then draw it as usual, and if not, just transparent. - Vladyslav Matviienko