Using internal drawings for Android

I'm trying to write a trest switch. But I can not access the standard com.android.internal.R.styleable.Switch_track , which can be used as a background.

Any idea how to get this opportunity?

If there is another approach for getting the default background, please let me know.

+4
source share
2 answers

You should not access personal resources; you cannot be sure that the resource will be available on all devices. And even if it is available, you cannot be sure that it will be the same.

If you want to use a private resource, you need to copy it to the project resources from the SDK or Android sources.

+3
source

For reference only: Although you are not recommended to access internal resources, and you should be aware that they can be changed or can be deleted by the supplier or with an OS update, you can access them at runtime:

int id = Resources.getSystem().getIdentifier("Switch_track", "styleable", "android"); 
+5
source

Source: https://habr.com/ru/post/1439773/


All Articles