How to access default images for Android (for example, thumbnail image spacebar when pressed) from java code?

How to access default images for Android (e.g. thumbnail image when clicked) from java code? I change the thumb, but I copy from the platforms / android -12 / data / res / drawable-hdpi to my drawable-hdpi folder in the project, but it depends on the platform (element color, size, etc.). Can someone show me how to access this default Android element from java code?

+6
source share
3 answers

Android contains a number of standard resources, such as styles, themes, and layouts. To access these resources, qualify the resource link using the android package name. For instance,

ImageView img = (ImageView)findViewById(R.id.imgView1); img.setImageResource(android.R.drawable.ic_media_play); 

Note. But you can only access resources available in android.R packages.

Look here android.R

+8
source

In general, you must use android.R to access Android resources using code. [everything you want, for example, layout, drawing, etc.).

Hope this helps.If you need any other help, please shoot her!

0
source
-1
source

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


All Articles