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 ?
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"
setImageResource(): Use a resource id to set the content of the ImageView. setImageUri(): Use a URI to set the content of the ImageView.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With