'Is there is a way to add the color to that the part outside the rectangle and the body itself make it transparent (Using XML)
I want to exchange the pink part with the transparent part in the code
forexample image to the shape I work on
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="@color/primary_color"/>
<size
android:width="25dp"
android:height="25dp"/>
<corners
android:topLeftRadius="10dp"/>
Solution 1:[1]
No, you can't do this using XML only.
You can solve in runtime by creating a Bitmap+Canvas, fill the Bitmap using appropriated color and then SUBTRACT the Drawable/Shape you linked as a Mask using PorterDuffXfermode.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | emandt |
