I would like to use some of the default menu icons provided by the Android OS.
The XML would be something like this:
<item android:id="#+id/menu_refresh"
android:icon="#android:drawable/ic_menu_refresh"
android:title="#string/menu_refresh" />
But the documentation says this is unadvised.
Warning: Because these resources can
change between platform versions, you
should not reference these icons using
the Android platform resource IDs
(i.e. menu icons under
android.R.drawable).
I thought the whole point of using the default icons is because the design does change from OS to OS. By using the default icons, your app will look and feel appropriate for the OS it's running on. So what is so bad about using the default icons? It seems like not using the default icons would hurt the appearance of the app.
The problem is that you are adding in a dependency that google does not guarantee will be static.
The names of these icons could change, the size could change and become incompatible with your app.
If you want icons to be the same as the current google ones, you can use the ones available here
It is very possible that some configuration of android will NOT have these resources read: HTC Sense, Samsung TouchWiz.
What you can do is find the drawables you want in your sdkFolder/platforms/platform-#/data/res/ and drop them into your project. Then reference them as you would any normal resources (#drawable/icon).
IMO, in practice you can use menu icons provided by Android OS, as long you use only the icons provided by OS for all your menu items. If you need another icon (say, refresh), you will need to copy images for other icons as well. Otherwise, if you mix your own and OS icons, visual styles may differ significantly on some devices.
I really can't think of a reason not to other than what if your operation does something more than slightly different from the associated action the OS does. For an exagerated instance, if you had your trash can button be the place where you created new widgets. But I figure if you are keeping the operations similar to those of the OS, then you are fine. In fact I agree with you, it may even look better for the app.
The problem is with the "customizations" each carrier or factory makes to the OS, so you cannot assume they are present or match the use. Anyhow,if you like them, you might just copy them to your drawables, as they will look standard no matter the customizations.
Also it can vary from android version to another android version.. So it would be best to include your own set of icons
Related
I'm trying to use Android's material icons in a View from within my app. I can't seem to find an example anywhere of how to reference them. I can't imagine, for this standard set of icons, that I'm required to copy and paste them into my actual app under the res directory. Surely there must be a simpler way since 90% of Android apps are using the same drawables! What I'm looking for is something like:
<TextView
...
android:drawableLeft="???" />
Is it possible to do this and reference the drawable from some package that I import? Or do I actually have to copy all the icons I want to use into my application resources? That seems completely unnecessary to me.
The developer guide says they're named */drawable-{{density}}/ic_{{name}}_{{color}}_{{size}}dp.png but it's precisely the * which I would like to know (and I hope it's not myapp/res/drawable!).
You can try Android Material Design Icon Generator plugin for Android Studio, If you are using Android Studio. Link to the plugin development Git repo is here
It is Easy and convenient. You can go through the image set and get the name from the google material design official website and then, you search for it and you can add that one to your project without any hassel.
Yes, you have to copy all your icons to your res folder. It's been said by Google somewhere. The "Material Icons" website clearly is oriented towards that and it makes it easier. One important reason to do this is that you'll want the icons to work not only in Lollipop, but also in previous Android versions.
Is there a easy way to have our application look like ICS or JB?
Mainly the slider and the radio button. They look old when displayed in green.
Any hint about this?
There's a nice package available on github called HoloEverywhere.
One thing though, do not try pass it off as a ICS/JB Application, just because it "looks" like the user interface one would expect to see in a native ICS/JB Android set up.
Best that can be done with the project, is to target the latest SDK to guarantee your wide-market of Android usage, including GB.
Aim high, not low ;)
The best way is to use the Android Library 'Actionbar Sherlock'. This Library uses all native ICS Themes, etc for older devices.
ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
In the guidelines found in http://developer.android.com/guide/practices/ui_guidelines/index.html for menu and status icons, we have distinctive design approach for Android 2.2 and earlier and Android 2.3 and later.
My app is going to support Android 2.2 and later. I was thinking that i should follow the 2.3 and later guidelines.
Do you agree?
You can follow multiple styles by creating subfolders with the correct android version specifiers inside your res/ folder (e.g. drawable-v11 for API 11 - check the official documentation here). So I suggest supporting multiple styles.
This is obviously a bit more work. To make this easy for standard icons like notifications, check out the Android Asset Studio. This is a small webapp that creates these icons to your specifications and builds a zip with the multiple styles, already sorted into the different res/ subfolders.
On thing you could do is include assets for both builds, and at run time, figure out if you're on 2.2 or 2.3, and show the appropriate assets. This can be done with build.version or this method for earlier releases.
Of course, if you want multiple icons, I don't believe this method would work, as that needs to be build into the android manifest.
It is recommended that you copy images into your project. But what about everything else?
I designed an app on 2.1... but it looks different on 2.3.3. There are minor things like the background of alert dialogs, context menus, options menus. And for some reason I can't get this ic_dialog_generic to show up in 2.3.3 even though I have it in my project.
What's the best way to handle these things?
This only partially answers your question, but you can sometimes reuse drawables from android.R.drawables. In practice, I've seen my interface stay readable and fashionable enough through android 2.1 to 3.0 using the public drawables in context menus and the like.
See this useful resource based on stock android 2.2
i've noticed that the default look of tabs has changed between Android versions (see screenshot). I like the first version better, but i need to set my android target to version 8 (android 2.2) so that app2sd works. but then i have the darker backgrounds. how can i switch to the old one? setting the background color manually produces ugly results
Since TabView is a standard widget, it likely relies on a system resource in android.R (or similar.) Because the theme was changed, you would have to manually extract the old images from older android source, copy them to your project, and hook them up to your TabView.
Remember that if your app were able to run on earlier versions of android, on certain custom ROMs, or phones that deviate from the standard android UI, it would look different on each unless you manually set it up to use a specific skin set.