Android: Button Drawable Default - android

I am trying to use the default Theme.holo button drawable for Android but I cannot find the standard one that's used whenever you create a button. I have tried checking everywhere in the sdk\platforms\android-19\data\res\ but to no avail. Any help searching for it would be appreciated. Thanks in advance!
It looks like the one on the left here, but is mildy transparent.:

The drawables for your theme are located in:
platforms/android-*/data/res/drawable-*

See this link
As it says you can find the drawables in
yourandroidsdkrootfolderpath\platforms\android-11\data\res\drawable
(ex:D:\android\platforms\android-11\data\res\drawable)
EDIT
Correct path
yourandroidsdkrootfolderpath\platforms\android-8\data\res\drawable-mdpi

Related

AndroidStudio Adding an image to draw with srcCompat

I am trying to do a drawer activity with Android Studio and I'm wanting to personalize the icons used. I've downloaded the icons I want to use and for the most part, it's okay.
In fact, I can modify all the android:icon icons but I have no idea how to modify the app:srcCompat icons. I don't know how to detect the image I want to use in this case...
Do you know how I can do it? Could you explain this to me?
Thanks a lot!
Edit: The file I'm working on as a base is the generated project with Drawer activity as the main activity. For example, if I wanted to modify the icon in the nav_header_main.xml file, how could I do to have my image (.png) transformed in a way detected by Android Studio as compatible with srcCompat
Ensure your image file is in res/drawable folder(or drawable-xhdpi/xxhdpi, determined by your design)
Refer it by app:srcCompact="#drawable/$IMAGE_FILE_NAME" in your xml.
Then you should see what you want.
Please check the doc to further understand the official usage.
Well... I was blind! I was wondering how I could add my icons but they were, I was just mistaking on the address... #android:drawable/... is obviously not #drawable/... but I didn't notice. So be aware that there is a difference and it'll be okay I think!

Change default icon creating a new Android Eclipse project

Does anyone knows how to change the default icon that is embbeded here? In order that all new applications that you create has that icon instead the android default one.
I tried to look for it into /android-sdk-linux/platforms/android-[VERSION]/data without success. :( Is it named ic_launcher.png?
Thanks in advance!
EDIT: Please read before vote or answer. Is not how to change the icon app, this Q is about how to make it default for ALL new projects.
:)
For the interest of everyone:
The default icons are in this path:
/eclipse/plugins/com.android.ide.eclipse.adt_xxxxx.jar/templates/
Here you can define also a new default package and a header for ALL your activities.
If you intend to change your launcher icon just modifying your manifest.xml; Please refer to http://developer.android.com/
This way you can have a different icon for each project. If you just want to change the default one I dont see what is the purpose of it but maybe it is defined in your adtbundle here: \YOUR ADT BUNDLE\sdk\tools\apps\SdkController\res

Styled Toggle Buttons in Android

I was reading the tutorial on Styling the Android toggle button here. The author asks us to create the 9patch drawable for both. I have trying to do this all morning, but have not been able to. Could anyone share the images with me, or tell me where i can get them ?
Kind Regards
You can find the 9patch drawable tool in the SDK folder in the tools folder.
It's a very useful tool for creating 9patch images, and you should be able to make your toggle button with it
There are links to 9-patches here: https://stackoverflow.com/a/15640365/2066079
The ones provided will style your togglebuttons to look like switches (which are only available in v14+)

Android R.drawable icon to reduce zoom

In the Android list of R.drawables (http://developer.android.com/reference/android/R.drawable.html) I can find the ic_menu_zoom button, which have a little plus sign inside.
Does anyone know about a similar menu button, but with a minus sign? I can't seem to find anything in the reference.
Thanks.
You are looking for the wrong kind of icon. It clearly says that it is a menu icon ic_menu_zoom.
What you are really looking for is the btn_plus_ and btn_minus_ icons. Note that I've omitted the states. You'd actually want all button states to combine them into a StateListDrawable.
Alternatively you can take a look at the btn_zoom_ icons.
Maybe try btn_minus_default and btn_plus_default.
Edit:
Or check out this link.

How to get a Button's background back to default (programmatically)?

So I'm setting a button's background doing this:
b.setBackgroundResource(R.drawable.custom_button1);
How do I programmatically set it back to the default (boring grey) Android button? Is there a R.android.boring_grey resource identifier I can reference without recreating those states myself? Couldn't seem to find it. Maybe my Googling skills are failing me.
Oh and by the way I tried this:
b.setBackgroundResource(0);
And the button actually disappeared (blended with black background?).
Have you tried this?
android.R.drawable.btn_default;
first get the default background of Button b; using
Drawable d = b.getBackground();
then set another background of your choice
b.setBackgroundResource(R.drawable.custom_button1);
if you need default background again use this
b.setBackgroundDrawable(d);
Use this
b.tr.setBackgroundDrawable(null);
I did it by
this.setBackgroundResource(android.R.drawable.btn_default);
try
button.setBackgroundResourses(R.drawable.yourimage);
it will set the default background of buttons.
and you can read more default properties of android widgets from given link:
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml
Drawable for "modern" button in XML is #android:drawable/btn_default_material
It does not exist in android.R.drawable for some reason.
EDIT: it's private, so don't use it.

Categories

Resources