Is there a default delete icon in Android? - android

I would like to add a delete icon (trashcan) in my actionbar. Is it a default icon can that an app can use or should the icon be a drawable in the app itself?

You can use #android:drawable/ic_menu_delete in your menu XML. This will show the default delete icon across different versions of Android (meaning it will be different on different OS versions). If you want it to be consistent across all versions, you can also download icons from https://github.com/google/material-design-icons and include them in your project drawables folder.

I would very much recommend this icon pack from Google:
https://github.com/google/material-design-icons/releases
It includes their set of Material design icons.
Navigable here:
https://www.google.com/design/icons/
Update:
This repository is extremely useful, with many Google / Custom icons:
https://materialdesignicons.com/

Related

How to change icon colors in android studio

I downloaded some icons from material.io but they only offer the icons in black. I saw a youtube video where they use to allow you to choose the color. Anyway, I am trying to change the colors of the icons to white. I am not having any luck. I tried to change the fill color in android studio but it doesn't work. Any assistance would be appreciated such as exact code and files to add the code to. Thanks.
simply you can use
android:tint="#android:color/white"
You can directly download these images in Android Studio.
res > right click > New > Image Asset and select
Icon Type : Action Bar and Tab Icones
Asset Type : Clip Art
Theme : CUSTOM
And you can select any clip art that you want, select the color, padding, etc ...
As mentioned before, the material.io icons can be downloaded directly with Android Studio. This solution shows the importing of vector asset icons which are easier to manage since they are stored in a single location (res/drawable) vs. image assets that will have each icon stored in specific density folders (hdpi, xhdpi, etc).
expand the "res" folder
right click drawable
hover over "new"
select "Vector Asset"
click the image next to "icon"
select desired material.io icon
Name the icon what you would like
select "next"
Now you will have two options of setting the icon color
In the layout by using the android:tint attribute of an ImageView. This is my preference because the icon can be viewed prior to runtime.
or
In Java.
imageView.setColorFilter(ContextCompat.getColor(context, android.R.color.white),
PorterDuff.Mode.MULTIPLY);
https://material.io/icons/ actually does let you download icons in white.
But, depending on what exactly you want to do, there are a few options. If you simply want white icons (and not to change them at runtime), you may find this plugin for Android Studio useful: https://github.com/konifar/android-material-design-icon-generator-plugin
It allows you to generate the material design icons right in Android Studio, in whatever color you want. Another alternative for downloading these icons in different colors is https://materialdesignicons.com/.
If you do want to color the icons at runtime, try something like this:
imageView.setColorFilter(ContextCompat.getColor(context, android.R.color.white),
PorterDuff.Mode.MULTIPLY);
You can download white icons from material.io. also look at themes and theme overlays
Instead of android:src
I use attribute android:foreground
android:foreground="#drawable/ic_add"
For those not getting what they want yet try changing the PorterDuff mode, the following is what did it for me
imageView.setColorFilter(ContextCompat.getColor(context, android.R.color.white),
PorterDuff.Mode.SRC_ATOP);
maybe
app:iconTint help you, I am writing this because of the following reference.
Material Design 3

how to add material design icons-font to an Android app

In my app there are a lot of places where i have to programmatically add icons into my textviews.
On the Android material design website i saw, that you can use icon fonts, but there is nothing that indicates that you can do this inside an android app, lose from the png and svg icons itself.
http://google.github.io/material-design-icons/
is it possible to use icon-fonts in android? and if it is possible how do i implemented this into my app?
can someone help me with this?.
With the latest version of the Android Studio, you can now generate the Material icon by
In Android Studio, open an Android app project.
In the Project window, select the Android view.
Right-click the res folder and select New > Vector Asset.
Vector images can also be generated by selecting vector image option
More information about vector assets can be found here https://developer.android.com/studio/write/vector-asset-studio
You could have a look at the Android-Ionics library: https://github.com/mikepenz/Android-Iconics
It has many built-in fonts including the Material Design Icon Font and can be used for ImageViews, TextViews and Buttons.
Apart from that you can use the Material Design Icon Font like any other font:
Download .ttf file and save it under main/assets/fonts
Define strings for the unicode values you need, e.g. something like
<string name="myicon"></string>
Load typeface in your application and set typeface for textview
Use string myicon as text in your textview
Unfortunately I can't find built-in solution for this, but you can check this samples with external libs
http://blog.shamanland.com/2013/11/how-to-use-icon-fonts-in-android.html
http://fortawesome.github.io/Font-Awesome/icon/android/
http://code.tutsplus.com/tutorials/how-to-use-fontawesome-in-an-android-app--cms-24167

Android Up Indicator Icon

This may be silly but I've been looking over an hour for the Up Indicator icon so I can customize it in my image editor tool. Where can I find that icon? It is not in the Android Design Icon Pack, as I just searched in it.
If you have SDK installed on your device, you can find the icon in %SDK-FOLDER%/platforms/android-*/data/res/drawable-*/ic_ab_back_holo_light_am . You can take from there and edit it.
Try this one: http://romannurik.github.io/AndroidAssetStudio/index.html
It has many other icons not only the up button. You can also change the icon color if you want.
My original answer called out that the icon exists in Android by default and that it does not to be manually added.
But this did not address the question as asked.
You should be able to get the icon from the Android libraries themselves, or from Google material design icon back available here (https://material.io/tools/icons/?icon=arrow_back&style=baseline)

Where are the drawables or clipart from android.R.drawable stored?

I am integrating ActionBarSherlock in my app and I want to have some menus with some items and its respective icons.
I have looked into samples and documentation, and everything seems to be clear, but when I Inflate the menu, I can see just the text because there are no icons related to each item yet.
I would like to use the icons you see when creating an android project:
But I can't find it, and I don't want to use direct reference to android.R.drawable in order to use those clipart icons, because I have read it is recommended to have the files in drawable folders.
android-sdk/platforms/android-xx/data/res/drawable-yyyy
where xx is your target platform and yyyy is mdpi, hdpi, etc.
Copy the icons you want into the appropriate resource folder in your project.
I generally use Android Asset Studio to create icons for my apps. It has all the standard clipart, and can generate the proper files for all other icons as well.
http://developer.android.com/design/downloads/index.html site has Action Bar Icon Pack
You can use system icons by using "#android:" prefix. The icon is not copied to drawable folders, so the application size is smaller"
Example: android:icon="#android:drawable/ic_menu_preferences"
List of icons at /platforms/android-/data/res/drawable-hdpi
Note 1: If you want to copy the icons to drawable files you can also do it in eclipse by using file /new/other/Anddoid icon set/clipart button/choose button.
Note 2: the icon set could change among platforms. That is why people are suggesting to copy resources. If the applicacion is just at development state you could just link the platform icons

Theming in Android - Eclipse

So I am editing a go launcher template theme and i saw there were some parts i wanted to change that wasn't included in the template. For example the little icons on top of the apps when you want to delete (kill.png kill_light.png etc.) I added this code
<AppIcon text_color="#FFFFFFFF" text_bg_color="#ff3f3f3f" delete_app="kill"
delete_app_highlight="kill_light" new_app_icon="new_install_app"
update_icon="appfunc_app_update" locker_icon="promanage_lock_icon"
close_app_icon="promanage_close_normal" close_app_light="promanage_close_light"/>
With png's with the right names in the drawable hdpi folder but they don't show up when I test it out. Am I missing something? I was able change the media management icons in the app drawer by adding this
<SwitchButtonBean button_galleryicon="appfunc_mediamanagement_switch _button_gallery"
button_gallerylighticon="appfunc_mediamanagement_s witch_button_gallery_light"
button_musicicon="appfunc_mediamanagement_switch_b utton_music"
button_musiclighticon="appfunc_mediamanagement_swi tch_button_music_light"
button_videoicon="appfunc_mediamanagement_switch_b utton_video"
button_videolighticon="appfunc_mediamanagement_swi tch_button_video_light"
button_appicon="appfunc_mediamanagement_switch_but ton_app"
button_appiconlight="appfunc_mediamanagement_switc h_button_app_light"/>
But it didn't work for the other part (the smaller versions of those same icons in the media management menu).
What am I missing?

Categories

Resources