Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access android default images ( for example image for seekbar's thumb when is pressed ) from java code?

How to access android default images ( for example image for seekbar's thumb when is pressed ) from java code ? I am changing thumb but and I copy from platforms/android-12/data/res/drawable-hdpi into my drawable-hdpi folder in project, but it is platform dependent ( color of item, size and so on). Can someone show me how to access this android default item from java code ?

like image 818
Damir Avatar asked Dec 02 '11 09:12

Damir


People also ask

What is ImageView in android?

ImageView is also commonly used to apply tints to an image and handle image scaling. The following XML snippet is a common example of using an ImageView to display an image resource: <LinearLayout. xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"

What is the role of setImageResource in Android Studio?

setImageResource(): Use a resource id to set the content of the ImageView. setImageUri(): Use a URI to set the content of the ImageView.

How do I add an image to a resource file?

To import image resources into your project, do the following: Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import.


1 Answers

Android contains a number of standard resources, such as styles, themes, and layouts. To access these resource, qualify your resource reference with the android package name. For example,

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

Note: but you can only access the resources which are available in android.R packages..'

Look at here android.R

like image 55
user370305 Avatar answered Sep 20 '22 06:09

user370305