Reputation: 17
this is my output: [1]: https://i.sstatic.net/MXUAv.png
this is expected :
[2]: https://i.sstatic.net/VrnDA.png
I have made a shape in xml and I have a problem giving it transparent and blur color. how should I do it here's my code to the xml:
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFFFFF"/> <corners android:radius="8dp"/> </shape>
Upvotes: 0
Views: 682
Reputation: 75
May you like this :
blur_img:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:endColor="@android:color/transparent"
android:gradientRadius="40dp"
android:startColor="@color/black"
android:type="radial" />
<size android:width="70dp"
android:height="70dp"/>
</shape>
and main_img:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/white"/>
<item android:drawable="@drawable/blur_img"/>
</layer-list>
Upvotes: 0
Reputation: 11018
You can't give blur using shape, the shape can max be transparent but can't be a blur. To easily blur just use some library instead of creating bitmap on canvas and then tweaking the properties.
Here is some example.
Upvotes: 1