简体   繁体   中英

How do I get the blur effect on Android?

I have to provide a background blur effect like in the picture. 在此处输入图片说明

The first layer contains text and switch.There is another layer below it.The properties of this layer color: #f8f8f8 alpha: 82.The actual color is present in the lower layer.True color in the picture is #D42E2E.These layers may look better in the picture below. 在此处输入图片说明

How can I accomplish this without using an external library?

This just looks like a gradient as background with light red center color and white border colors.

You can use this Gradient Generator to create your gradient. Save the gradient-code for example in your drawables-folder as gradient.xml and use this as background of your view.

This could be your gradient

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="linear"
android:centerX="50%"
android:startColor="#FFFFFFFF"
android:centerColor="#FFFF8A8A"
android:endColor="#FFFFFFFF"
android:angle="90"/>
</shape>

Result :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM