Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to use not public android resources in my application?

I need to use the following resources in my widget:

  • pressed_application_background_static
  • focused_application_background_static

I hope that usage of these resources will allow me to have orange background on standard android and green on HTC.

But they are not public, so usage of

android:drawable="@android:drawable/pressed_application_background_static" 

is not allowed. Is still there any way to use them?

like image 561
LA_ Avatar asked Apr 16 '11 09:04

LA_


People also ask

How do I manage resources in Android?

Resource Manager is a tool window for importing, creating, managing, and using resources in your app. You can open the tool window by selecting View > Tool Windows > Resource Manager from the menu bar or by selecting Resource Manager on the left side bar. Click Add to add a new resource to your project.

What is purpose of externalizing of resources in Android?

Externalizing your resources also allows you to provide alternative resources that support specific device configurations such as different languages or screen sizes, which becomes increasingly important as more Android-powered devices become available with different configurations.

What does an app do if it does not find a resource to match the screen density?

If no matching resource is available, the system uses the default resource and scales it up or down as needed to match the current screen size and density The "default" resources are those that are not tagged with a configuration qualifier. For example, the resources in drawable/ are the default drawable resources.


2 Answers

You can reference them like this

android:drawable="@*android:drawable/pressed_application_background_static" 

but it is not recommended, because private resources are likely to be renamed or removed in the future.

like image 140
Daria Avatar answered Oct 10 '22 00:10

Daria


browse the sdk for the drawable and copy it locally to you res/drawable folder. it will probably be an XML file but if you search for "pressed_application_background_static" you should find it without trouble.

like image 32
techiServices Avatar answered Oct 10 '22 00:10

techiServices