Android high imitation wechat voice chat page Gaussian blur (ground glass effect)

In the current application market, apps with ground glass effect can be seen everywhere. For example, people who have used wechat voice chat can find that Gaussian Blur effect is used on the voice chat page.

First look at the renderings:

Looking closely at the above figure, we can find that the background image takes the user's Avatar as the template, Gaussian blur it, and takes it as the background color of the whole page.

For a bunch of online introductions on how Android can quickly realize Gaussian blur (ground glass effect), please refer to the following article, a fast ground glass virtualization effect to realize candroid. The following directly gives the fuzzification tool class (which has been verified to be feasible):

So, can we use this tool class to highly imitate the wechat chat page? The answer is No.

Let's first look at the effects that can be achieved by using this tool class directly:

@H_ 301_ 26@

We can see that through this tool class, the ground glass effect of the picture can be realized, but it is not ideal, because the background color of wechat is dark, and the color of the picture we blurred is light. The effect is not satisfactory. People who know IOS may know that IOS has direct APIs for Gaussian blur: uiblureffectstyleextralight, uiblureffectstylelight and uiblureffectstyledark, while uiblureffectstyledark can directly achieve darker ground glass effect. What should I do if I put it on Android?

I use the strategy of "seeking the country by curve". If the background color is dark, we can use the FrameLayout layout and add a darker layer view.

In the above code, we can see that we have added an ImageView:

The effect diagram of the most important implementation is as follows:

Source address: https://github.com/zuiwuyuan/FastBlur_ VoiceChat

The above is the Gaussian Blur effect of Android high imitation wechat voice chat page 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
分享
二维码
< <上一篇
下一篇>>