Android custom Scrollview to achieve enlarged rebound effect example code

1. I just saw a very good user experience in other people's open source projects. The renderings are as follows:

2. Let's implement it. First, let's take a look at the layout. Generally, it is only the part of the method that we include the avatar, so here we want to divide the layout into two parts. The corresponding layout file effect diagram is as follows:

3. Customize Scrollview

Step 1: create a class, inherit from Scrollview, and override the corresponding constructor

Step 2: rewrite the onfinishinflate () method and record the first child view, our head_ fragment

Step 3: override the ontouchevent () method and set the_ Get the sliding distance in the move method by setting the head_ View to change its size and restore the head when it is up_ view

Change the head dynamically through attribute animation when springback view_ View, and override the onsizechange () method to record the head in real time_ Width and height of view

In this way, our effect is realized. Let's take a look at our own effect:

Demo download: zoominscrollview_ jb51.rar

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>