Change item when clicking Recycler View Head

Asked 2 years ago, Updated 2 years ago, 24 views

I'd like to implement it as shown in the picture with Recycler View

If you press the head button, the existing item will go away and the new item will be visible The name of the head changes

You want to configure a screen that makes all the lists visible when you press the footer.

What about the screen composition and the name changes when you click the button.

I don't know how to change the item or how to bring up all the lists when I press the footer.

What should I do? ㅠ<

android java

2022-09-21 23:04

1 Answers

When you click the head button, the model needs relevant information to process a particular item visible/gone. For example, if the item model has a field called type, and the head button is toggled, the item with type 1 is treated as Gone, and the item with number 2 is treated as Visible. This is why the item model must have information to classify each time the head button is clicked. If you have this information, you can perform viewable/zone processing according to the status of the head button in the onBindViewHolder() of the RecyclerView.

You can also apply the above method when you click the footer button. If the footer button is toggled (enabled) in the onBindViewHolder(), the desired implementation can be created by visualizing all item views, regardless of the status of the head button.


2022-09-21 23:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.