Color changing effect of sliding up and down Android search box

Sliding the search box up and down to change transparency is a very common effect in app. Let's see the effect first:

First, let's look at the layout skeleton:

The whole is a relative layout. The search box directly covers the listview. The picture at the top of the rendering is the header layout of the listview; This effect mainly uses listview's Sliding Monitoring; When the listview slides, keep getting the distance from the ImageView to the top of the screen; Then get the height of ImageView itself; Judge whether the ImageView slides out of the screen through these two values, and set the transparency of the search box according to different situations;

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