Size of bitmap in Android
<p>I have to use drawable in my code with icon, because I want to set background in my holder.</p>

<pre><code>holder.itemView.setBackgroundResource(R.drawable.my_drawable);
</code></pre>

<p><code>itemView</code> is instance of <code>View</code>.</p>

<p>Unfortunately I cannot set size attributes for in xml.</p>

<p>my_drawable.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item&gt;
        &lt;color android:color="@color/background"/&gt;
    &lt;/item&gt;
    &lt;item android:right="16dp"&gt;
        &lt;bitmap
            android:src="@drawable/ic_android"
            android:layout_width="18dp"
            android:layout_height="18dp"
            android:gravity="right|center_vertical"/&gt;
    &lt;/item&gt;
&lt;/layer-list&gt;
</code></pre>

<p><strong>Question</strong></p>

<p>Is it possible to set size of icon in my drawable ?</p>