Hello. You must implement a view element that expands when clicked. The example is implemented in the clock application in Android (see screenshots). Tell me which way to google, or maybe there are standard implementations. ExpandableTextView looked, but, it seems to me, this is not exactly what I need.
1 answer
At the heart of this screen - the ListView or RecyclerView / Adapter of this list should display two types of items - expanded and compressed. In the data for the adapter, there should be a field defining the state of each item (it is revealed or hidden).
The getView() method of the adapter reads this field and sets the appropriate visibility for display by the setVisiblity() method for the items attached to the item.
When you click on the disclosure \ hide button, the corresponding state is recorded in the data and the adapter is updated to redraw the new view.
RecyclerView allows you to use animations of this process through the notifyItemChanged() method
|


Viewhas a visibility parameter (in XML -android:visibilityor in the codesetVisibility()method). For elements that should not be displayed in the "hidden" state, assign it toView.GONE. When you need to "open" - installView.VISIBLEfor them and that's it. - pavlofff pmListView(RecyclerView), each alarm clock has an item in it. When you change the visibility of items in the item, everything will shift as it should after updating the list adapter. - pavlofff