Is it possible to configure Android Studio to display only the @drawable
resources that are inside the project folder?
The project I\'m
Looking through the AS's 'Code Completion' section, I didn't find any setting which allows to hide the SDK resources and use the app/lib resources instead:
The recently implemented feature, mentioned by StefMa, probably will not help you as it works the other way: it allows library developers to hide some of the resources from the aar package and show only selected portion of resources, aka public recources. Chris Banes made a good intro in this feature here.
I don't think you can do that actually, only library developers can choose to hide the resources in their aar
distributions.
So you are dependent on library developers to do that for you. Luckily the latest Android support library should already have done this for you.
The way library developers can hide resources in their library is:
res
called res-public
(name not important) with a subfolder called values
:src main java res res-public values
public.xml
, where you define all resources that you want to have public with their name
followed by type
<resources>
<public type="drawable" name="btn_login"/>
</resources>
build.gradle
file:android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
sourceSets {
main.res.srcDirs 'res', 'res-public'
}
defaultConfig {
...
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
aar
file and include that into your project. Only the btn_login
resource will now be visible.
aar
file, so you can test without pushing to a Maven repo.