I have a drawable xml file which draws a circle.
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666" />
<size
android:width="120dp"
android:height="120dp" />
</shape>
now, I have to add a image in drawable folder. please help me where to change the code.
Drawable drawable = ResourcesCompat. getDrawable (res, R. drawable. myimage, null);
You can use a layer list like this
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="120dp"
android:height="120dp"/>
</shape>
</item>
<item android:drawable="@drawable/your_drawable"/>
</layer-list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With