How to get the private drawable to use in activity in android? - android

I want to use private drawable from android. for that i have downloade androi-8.jar which contains all the .png imgaes i want to use in my activity. i want use "btn_circle_disable_focused " drawable to the buttton but it shows me error regarding private resource. i want to use it in imageview also.

You should copy desired .png to your project's /drawable folder. you can access it from xml like #*android:drawable/btn_circle_disable_focused but it's not a good idea cause drawable being private means it may be unavailable on some devices.

check this google icon design to download every icon you want.

Related

How to use drawable resource from library module in to our application module?

I am using android studio 2.1.3,
i have import compile 'com.android.support:appcompat-v7:23+'. Now i want to use images from appcompat library in my application module. Please give reply as soon as possible.
I have attached screenshot. Please check image.
You cannot do that.Most of the resources in appcompat library is private.This library has public.xml in res/value of it and only the resources defined in this xml are accessible and the rest of the resources are implicitly private and android wouldn't give you suggestion to use them.Your best bet is to download a copy of it and put it in the drawable of your own application so you will be able to refer to them.
Resource: https://developer.android.com/studio/projects/android-library.html
For xml-
Make an imageview.
Write this inside the image view-
android:src="#drawable/name"
and it shall work
So now click on the clip art icon and there are hundreds of icons and pics. They are probably the same as of the external libraries. Click next for whichever image you want and that will be added to your drawable folder and then you can use it.
Add imageView in xml and add background.
android:background="#drawable/any_image_you_want"

Android: Locating basic drawable

How do you reference the drawable for the 'home as up' icon?
I am trying to add this drawable in a custom XML layout. I do not want to change the icon displayed in the ActionBar, but rather use the drawable for something completely different
Tips on how to go about finding it without searching through every item are appreciated!
This image is named as ic_ab_back_holo_dark_am.png
or ic_ab_back_holo_light_am.png
These images are at sdk/platforms/version/data/res/drawable-versions where version must be 11 or later.
like
sdk/platforms/android-19/data/res/drawable-hdpi. You can find all images from there with there actual name.

Android Wheel-like loading icon

I'm trying to render a loading circle in one activity whose data gets populated by an async task. I'm not using default progressbar, because the icon in older version of Android looks like this:
I know how to use an ImageView or ProgressBar with a custom image and a rotation animation, but I haven't been able to find new official Android's looking icon anywhere. The one that looks like this:
Or maybe there is another way to generate this kind of spinning wheel animation in Android 2.2.
In general it's good to stick with the style set on that system.
If you still want the newer spinning wheel animation, set the indeterminateDrawable XML property on the ProgressBar. You can find the drawable XML files in the SDK folder under [android-sdk]\platforms\android-17\data\res\drawable called progress_medium.xml and others. You'll also need the referenced icon files stored in the drawable-**** folders.
check folder SDK_DIR\platforms\android-x\data\res\drawable-hdpi.
There should be spinner drawables like "spinner... "

How to import/add icons from the icon pack/template pack into my android app?

I've downloaded the icons pack and the template pack from here: http://developer.android.com/guide/practices/ui_guidelines/icon_design.html#templatespack
and the icon pack and other stuff from here: http://developer.android.com/design/downloads/index.html.
I don't know how to put them in my app.
Is it in the code?
You can put them inside your res/drawable and use them in your app. You can either put them in your xml file or you can add them programatically.
Once inside the drawable, they can be accessed throug #drawable/resourcename in the xml file. eg,
android:background="#drawable/image1"
When doing it programatically, what we do is we set an imageview and load the drawable resource into the imageview.
ImageView iv = (ImageView)findViewById(R.id.imageView1);
iv.setImageDrawable(image);//where image is a drawable object
This would be a good read.
It must be in res/ folder of your project.
Put all of them in drawable folders of the project and then they can be accesses using R.drawable.file_name.
If you want to set the launch icon of your APP, you should put your icons into res/drawable-ldpi, -mdpi, -hdpi or -xhdpi.
Then create a folder, called drawable in res folder and add there images. then you may use them from XML by calling: android:src"#drawable/imagename.png" or programmatically getDrawable(drawable ID). You may also put your pictures into assets.
Right click the res/ folder and go to new->other.
Expand the Android folder and click android Icon set, then click next and follow the wizard all the way through.
Then you can do a clean and rebuild and they should be available!

android system drawable ic_btn_round_more

is there some way how to access android system private drawable: ic_btn_round_more?
This is the more icon which is used
in DialogPreference (res.layout.preference_dialog.xml)
It's not accessible through android.R.drawable
I don't want to copy bitmap file, because
that icon can be different for every device.
I found this: http://www.androidjavadoc.com/2.3/android/R.attr.html#moreIcon But I'm not sure how can I use it. Basically I'm trying to add more icon to my custom ListView,
which whould look exactly android way.
You can use Nine-patch to create your own rounded button which can be exactly the same as drawable ic_btn_round_more. you can get more information about how to use Nine-Patch here : http://developer.android.com/guide/developing/tools/draw9patch.html

Categories

Resources