I want to add a feature on my app to let users give a feedback on data. (for example to report errors or mistakes).
Is there a standard icon for it?
please, visit your android-sdk-* folder, there should be default set of icons and pictures in the ./platforms/android-XX/data/res/drawable-Xdpi/ where "XX" and "X" stand for your android version and screen size. all the standard icons are there.
There are a few system icons whose filenames match 'feedback', but none of them look appropriate to me.
Best I could find is "ic_menu_report_image.png".
I've been using "ic_menu_start_conversation.png".
Whether it’s useful for your app mainly depends on the iconset you’re already using. In a chat-app for example, this icon would be a poor choice :)
Note: this icon is marked as protected. You'll have to copy the images to your source manually.
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). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.
Related
I am programming an android application and I'd like to use the system icons for mail, phone, calendar and contacts inside this application. The problem is, that these icons differ from system to system (different android versions and different smartphones) and I want to keep the application and the system consistent. Is there an easy way to achieve this?
In XML use default android drawables from #android:drawable/... and in code use android.R.drawable....
You can use the standard drawable using
#android:drawable/[icon_name] in your xml file
android.R.drawable.[icon_name] in your java code
You can see different icon in your file system in
[SDK PATH]/platforms/platforms/[ANDROID_VERSION]/data/res
Some images are standard...like contacts, calendar :)
You can't keep system consistent. For what? New versions of Android are usually prettier than older ones (well, it's my opinion).
The only way to keep system icons same for your app - copy them into your drawables instead of using direct reference to them (like #android:drawable/).
First of all if you intend to use the default images (icons) for mail , phonr etc.
This default can be used as android.R.drawable.name in code or #android:drawable/ in xml from http://docs.since2006.com/android/2.1-drawables.php
But as this will vary from OS versinos to Versions.
So , if you need to use an unique GUI for the app for all versions and devices.
Please do not use android provided images , simply use your own graphics or images supplied in drawables resources explicitly by you for your app.
If you're ok with icons from each system you can get it via PackageManager and getApplicationInfo method.
If you're not, you should copy the resources from the platform into your own application.
If you create an activity and set a label without disabling the title bar you will see a title that uses a gradient as a background. Is there a way for me to re-use this resource without re-implementing it?
Thanks
I believe the background for this comes from the resource that is called "activity_title_bar.9.png" that is in the system drawable folder.
Here is a copy of it:
If you download it from here you'll have to rename it using the .9.png suffix. You can also find it in your SDK. The path is "SDK\platforms\android-4\data\res\drawable"
Note android-4 could be any other number that you happen to have installed on your machine.
Generally if you are wanting to use a system resource like this best practice is to save your own copy of it and include it in your project. Resources like this are subject to change at any time with new versions of the OS (or even with device specific skins that Manufacturers add on to the OS) So if you rely on the system copy from inside your app then you have no way to know for sure that it will look the same across all devices.
I'm trying to use one of Android's spinner drawables (spinner_black_16, spinner_black_20, spinner_black_48, or spinner_black_76) as demonstrated on this page. My project is using SDK 2.1, so I updated it to 2.2 as that page states is the SDK version where these are included. Unfortunately, none of the android.R.drawable.spinner_black_xx appear to be defined.
Are these drawables not available for developer usage? The only other way I seem to be able to access them is via the following convoluted method:
final Drawable spinner = new ProgressBar(context).getIndeterminateDrawable();
Unfortunately, that provides me the white spinner, not the black one.
The best way to access those drawables is to copy them from your SDK directory into your project and then access them like any other resources.
The drawables are located in $ANDROID_SDK_DIR/platforms/android-*/data/res/drawable-*/. You can download and select the version of the OS that you'd like to pull drawables from. API level 7/OS version 2.1 has the full complement:
platforms/android-7/data/res/drawable-mdpi/spinner_black_16.png
platforms/android-7/data/res/drawable-mdpi/spinner_black_20.png
platforms/android-7/data/res/drawable-mdpi/spinner_black_48.png
platforms/android-7/data/res/drawable-mdpi/spinner_black_76.png
platforms/android-7/data/res/drawable-hdpi/spinner_black_16.png
platforms/android-7/data/res/drawable-hdpi/spinner_black_20.png
platforms/android-7/data/res/drawable-hdpi/spinner_black_48.png
platforms/android-7/data/res/drawable-hdpi/spinner_black_76.png
Though it doesn't currently, Android's official "Icon Design Guidelines" used to explicitly address this situation and recommend copying:
Because resources can change between platform versions, you should not reference built-in icons using the Android platform resource IDs (i.e. status bar icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.
I've noticed that some system programs in Android (Messages, Contacts, Settings, ...) uses the same icon in the menu (search, add, ...), and they're different in (almost) every OS version.
So I have a question. Are they come from system files? Can I use these icon in my program without having to capture-copy-paste them into res folder?
Thanks.
This is what Android UI Guidelines say about Menu Icons:
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). If you want to
use any icons or other internal
drawable resources, you should store a
local copy of those icons or drawables
in your application resources, then
reference the local copy from your
application code. In that way, you can
maintain control over the appearance
of your icons, even if the system's
copy changes.
Yes you can use system resources without copy-ing them to your res folder.
Here is an nice collection of a lot of system drawables.
http://androiddrawableexplorer.appspot.com/
Implementation: e.g.: android:icon="#android:drawable/ic_menu_save"
by coding we can use like this
android.R.drawable.ic_menu_save
can anyone tell me where I get the icons native android?
I think what you are asking for is the icons that are used by the Android OS. If that's the case you can view them in the android.jar file that is installed with the SDK.
<sdk-install-path>/platforms/<any-platform>/android.jar
If you extract that jar and have a look at the res/drawable* folders you will see the icons used throughout the OS. You can also access them from within your code using:
#android:drawable/<name of drawable>
It's not clear if you want to access the icons as files or through your application. If you want the actual icons you can grab them from the source code.
The source code for Android is available here at android.googlesource.com:
https://android.googlesource.com/platform/frameworks/base.git/
Specifically:
https://android.googlesource.com/platform/frameworks/base.git/+/master/core/res/res/drawable-hdpi/
Many of the Android icons / resources are available by resource ID. The resource IDs for those are in the android.R class.
http://developer.android.com/reference/android/R.drawable.html
Material Icons seems to be a good address for a standard Icon set for android these days.
Check out http://www.yay.se/resources/android-native-icons it contains all the standard icons converted to vector graphics.