I have a gradient view which animates from left to right. I have a XML that describes the circle inside, but the borders of XML are actually rectangular as you can see, how can I make the overflow hidden of the outside of the XML. It looks like that only the background is a circle but not the the shape itself ,I thought that the solution is by using PorterDuff.Mode but it doesn't help.
this is my circle.xml file:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="2dp"
android:color="@android:color/white" />
<corners android:radius="7.5dp" />
<size android:width="327dp" android:height="211.5dp" />
</shape>
And in my layout i use it like this :
<RelativeLayout
android:id="@+id/white_rectangle"
android:layout_width="327dp"
android:layout_height="211.5dp"
android:layout_gravity="center"
android:clipChildren="true"
android:adjustViewBounds="true"
android:background="@drawable/circle"
>
<View
android:id="@+id/scanner"
android:layout_width="123.5dp"
android:layout_height="211.5dp"
android:layout_gravity="center"
android:background="@drawable/scanner"
android:visibility="gone" />
</RelativeLayout>
i don't want the scanner to go outside the borders