How To Reference A Drawable From A Library Project Into A Main Project's Layout In Android?
Solution 1:
You probably would need to add your own uri for library and use it to refer to drawable.
xmlns:vijay="http://schemas.android.com/apk/res/com.vijay.mylib"
Then you should be able to access drawable using
@vijay:drawable/myImage
Solution 2:
The best way to determine which drawable resources are used between a library project (lib project) and an application project (app project) is down to design:
By default, an app project's drawable resource will supersede the use of an identically named lib project's drawable resource. Therefore, the best way to ensure the lib project resource is used, is to remove the resource from the app project altogether.
Another issue i came across is that if you want the app project resource to be used in preference, be sure that the drawable folder name in the app project is identical to the resource folder name in the library project. I.e. if your lib project resources live in drawable-mdpi, ensure the folder is called drawable-mdpi in the app project too!
Post a Comment for "How To Reference A Drawable From A Library Project Into A Main Project's Layout In Android?"