Android realizes partial picture sliding guidance effect

Android realizes partial picture sliding guidance effect

The event listener code of viewpager is as follows:

In the event listener, the title and dot image are mainly transformed in the callback function onpageselected (int index).

Because the content below the sliding area is unchanged, that is, it does not slide. As I mentioned above, the content may exceed the scope of the screen, so we need to use Scrollview to display the scroll bar when there is too much content. Maybe some friends will think that to display the scroll bar, I also know to use Scrollview. What I want to say here is that there are both viewpager control and Scrollview. If the two views are used alone, there will be no problem. Unfortunately, however, problems arise when the two are used together. What's the problem? This is the phenomenon of rebound when sliding the picture, that is, it is difficult to slide when sliding. I feel very hard when sliding, and the picture can't slide. This is the conflict between the two views, because both views are sliding views, which will calculate the corresponding position and judge the corresponding distance.

How can we resolve this conflict? Here, we need to override the onintercepttouchevent() callback function of Scrollview. A new scrollviewextend class needs to be added to the program and inherited from Scrollview. The following is its code:

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>