Android nested recyclerview slide left and right instead of custom view
In the past, the left-right sliding effect was realized by user-defined Scrollview or linear layout. Recyclerview can do this function well. The general requirement is either an independent left-right sliding effect or a left-right sliding effect in the middle of a list
It is also easy in the list. Only a small problem needs to be solved. Personally, what is worth mentioning is the height problem. Generally, people use a fixed height, but the display in the list is different from the model. If it is fixed, it is difficult to ensure beauty, and the dynamic height can solve the problem
First, add a recyclerview control to a list control layout
Then comes the adapter layout
Next, write adapter
The focus is on the measure method to get the measured height
Then you can use it directly
It is very simple. It completely replaces the custom view. The effect is as follows. If there is no measurement, the height may not be suitable, or the text of textview may not be seen because it is too low or too high, which is not beautiful.
The above is the Android nested recyclerview sliding left and right instead of custom view introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!