0

Since it is not possible to create sub folders in a Drawable folder, I want to move the images to an asset folder, and divide the images into different folders.

My question, how do I access the image in the asset folder from the XML in the Drawable folder?

es f

hopeman
  • 2,778
  • 3
  • 18
  • 33
Michael
  • 429
  • 5
  • 22

2 Answers2

0

You cannot access assets images from the xml file. Assets files are available only via AssetManager.
You should decide if you want more to have images in subfolders in assets and load files programmatically (it's not hard) or set images in xml.
Edit: I've found the similar question , you can check some methods.

Defolter Ricaris
  • 129
  • 1
  • 2
  • 11
0

Instead of using the Assets folder you can specify additional resource folders in your app gradle ie:

    sourceSets {
        main {
             resources{
                 main.res.srcDirs+= "src/main/button_res"
             }
        }
    }
JacquesBauer
  • 226
  • 2
  • 7