0

I am creating an app for Android using Xamarin.Android, but this question applies to pure native Android as well.

I want to place this XML in my drawable folder so I can use it:

<?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
      android:drawable="@drawable/button_pressed" /> <!-- pressed -->
    <item android:state_focused="true"
      android:drawable="@drawable/button_focused" /> <!-- focused -->
    <item android:state_hovered="true"
      android:drawable="@drawable/button_focused" /> <!-- hovered -->
    <item android:drawable="@drawable/button_normal" /> <!-- default -->
</selector>

But I have 5 different drawable folders that Xamarin made for me in my Resources folder:

drawable-hdpi drawable-mdpi drawable-xhdpi drawable-xxhdpi drawable-xxxhdpi

Which folder should I put it in? Can I make a folder called "drawable" so that it is used on all screen resolutions? Or as a "fall-back" if the resource is not found in the respective folder?

Drake
  • 2,679
  • 4
  • 45
  • 88
  • 2
    As this is just an xml file. You should place it in drawable folder(created by yourself). drawable-hdpi drawable-mdpi drawable-xhdpi drawable-xxhdpi drawable-xxxhdpi. These folders are used for images with different resolutions. For image sizes follow this link https://stackoverflow.com/questions/14381965/image-size-drawable-hdpi-ldpi-mdpi-xhdpi/21972021 – Talha Q Oct 09 '17 at 01:42

1 Answers1

-1

Just put it in drawable and the system will figure out which @drawable/button_pressed, etc depend. You will have to put the button images in the correct directories though...

steven smith
  • 1,519
  • 15
  • 31