There is a MainActivity in which RecyclerView is displayed. It displays the names of articles and a picture of the article. There is also a second activation, which displays the selected article. At the moment, in the second activation there is no slider as in the picture below, I indicated just the usual activation with content. I want to make a slider in the second one. Those. the main part is occupied by the content of the selected article, and below, as shown in the picture, a slider from the pictures of elements is displayed. Clicking on the corresponding image content changes, as well as two buttons to scroll through the slider. Can you please tell me how to implement the second activity? Those. I think that there should be fragments, and then where to go?
2 answers
I would use ScrollView . you will need to remember the position of each element and when you press the button, scroll by 1 position to the left or right by ScrollTo or SmoothScrollTo . When you click a shortcut image, you must not forget to scroll the list to its position.
|
Android has a ViewPager for such purposes.
- I do not need to scroll through the entire screen, but only the pictures below. Is ViewPager suitable for this? Although it is possible to scroll the entire screen, but then it is necessary that at the bottom of the picture also scrolled as you scroll through the content. And the ability to separately scroll through the pictures below in the slider - OREO
|
