Android immersive status bar and suspension effect

1、 Overview

At present, the details pages of most e-commerce apps are almost the same, almost the picture of the above commodity. When you slide, there will be a tab suspended on it. This is really a good user experience. If the tab slides up, the user may need to slide down and click the tab. This is really troublesome. For the immersive status bar, Guo Lin said that Google did not give an immersive status bar. Google only said immersive mode. However, the name of the immersive status bar doesn't sound rough. Follow the public. However, the Android environment is not as unified as the IOS environment. For example, the virtual buttons of Huawei ROM and Xiaomi ROM are completely different. It's not easy for all Android developers.....

2、 Taobao effect

3、 Our effect

It can only pass 2m, which distorts all my beauties......

4、 Implementation class

Custom Scrollview (stickyscrollview)

Statusbarutil / / a very good status bar tool

5、 Layout

Note: we set the tab to be suspended to Android: tag = "sticky"

6、 Implementation code

Note: stickyscrollview. Setsticktop (int height) this method allows us to set the tab distance to start levitation

We continuously change the transparency of our title bar and status bar by monitoring the Scrollview sliding distance. Here we calculate several heights (sliding distance). Finally, calculate the total sliding distance, and calculate the value of transparency according to the sliding distance and the total sliding distance.

StatusBarUtil.setTranslucentForImageView(MainActivity.this,title); We use tools to achieve image depth into the status bar. The view passed inside is the view below the picture.

The above is the Android immersive status bar and suspension effect introduced by Xiaobian. I hope it will help 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!

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