Drawable resolution in custom widgets
<p>Good day, I am a little confused and sorry if it is dublicated, but I cant find correct answer. My task is to create widget (RadioButton, RatingBar) with custom drawables + make them high quality and not blur.</p>

<p>Here comes my problems and what I have tried. So, for example, I have custom drawable for radio buttons:</p>

<pre><code>radioButtonArray[i].setButtonDrawable(R.drawable.radio_button_selector);
</code></pre>

<p>radio_button_selector:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
&lt;item android:drawable="@drawable/rb_unchecked" android:state_checked="false"/&gt;
&lt;item android:drawable="@drawable/rb_checked" android:state_checked="true"/&gt;
&lt;/selector&gt;
</code></pre>

<p>Now the problem is in quality of drawables. If I will add <code>rb_unchecked.png</code> and <code>rb_checked.png</code> in different folders (hdpi,mdpi,xhdpi...) with different px size, then my radio buttons will be enourmous big on some phone screens. Ok, next thing that I tried was to set programmatically width and height of my radio buttons, but found that it is hard and unefficient (for example, I have the same situation with RatingBar and I cant find how to set custom width and height of items in it). Another solution that I tried is to add <code>rb_unchecked.png</code> and <code>rb_checked.png</code> only to <code>drawable</code> folder with size of 18px*18px and, on the one hand it solved the problem, size is correct, but the radio buttons now are low resolution and kind of blur.</p>

<p>My quastion is what I am doing wrong? I expected that on devices with different dp android will take specific image in hdpi/xhdpi folder and scale it to specific size, but instead of this images from specific folders just wrap_content | crop in my custom widget?</p>