I have to use drawable in my code with icon, because I want to set background in my holder.
holder.itemView.setBackgroundResource(R.drawable.my_drawable);
itemView
is instance of View
.
Unfortunately I cannot set size attributes for in xml.
my_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="@color/background"/>
</item>
<item android:right="16dp">
<bitmap
android:src="@drawable/ic_android"
android:layout_width="18dp"
android:layout_height="18dp"
android:gravity="right|center_vertical"/>
</item>
</layer-list>
Question
Is it possible to set size of icon in my drawable ?
According to Android Developers and to this post Android bitmap image size in xml it is not possible to set the size in xml