I really confused about android qualifiers.
I want to create custom design for RatingBar
. So I created rating_bar.xml
file and put it to drawable
folder. Here is the source:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background" android:drawable="@drawable/star_off"/>
<item android:id="@android:id/secondaryProgress" android:drawable="@drawable/star_on"/>
<item android:id="@android:id/progress" android:drawable="@drawable/star_on"/>
</layer-list>
I have star design for xhdpi displays only. I thought that if I put star_on and star_off images to drawable-xhdpi folder than everything will automatically be resized for all different densities (mdpi and hdpi). Yep, it resized, but I got some artifacts for hdpi and mdpi. The same as here: Android custom RatingBar image artifacts I tried solutions that were described there, but nothing helped me. On xhdpi devices I have no artifacts, but on mdpi and hdpi devices there are artifacts.
Then I decided to put star_on and star_off images to drawable-nodpi folder. So I got good result without any artifacts for xhdpi and hdpi screens, but for mdpi screen images were too big.
Then I decided to copy star_on and star_off images to drawable-mdpi folder and reduce images size. It also didn't help.
Then I put big star images to xhdpi and hdpi folders, and small star images to mdpi folder. I thought that if I run my app on mdpi device images from drawable-mdpi will be chosen. But it seems like Android choose images from hdpi or from xhdpi folder and scale them automatically for mdpi screen because I have artifacts again. I also tried to put small images to drawable folder. It also didn't help.
So how Android choose resources? I thought if I have resources шт drawable, drawable-mdpi, drawable-hdpi and drawable-xhdpi than Android try to find resource in folder with same density as device has. And if there are no such resource than it takes from drawable folder.