Is it possible to change material design icon color from xml in Android?

how to change icon color in android
material icons
change color of icon programmatically android
how to change icon color in imageview android
android change drawable color xml
material icons color
how to change svg image color in android programmatically
android drawable icons

I'm actually trying to use colored icons in my app. I've downloaded the official material design icon pack from here. Now all the icons in this pack are either white, grey or black. But I want the icons to be of a different color. Something like the icons on the left side in this image. The phone phone and mail icons are blue. How can I accomplish this?

For changing icon color try

<ImageButton
    android:layout_width="your value"
    android:layout_height="your value"
    /* and so on ... */

    android:tint="YourColor"
    />

Note: the tint color is painted ontop of the image, not a replacement color. So tint #80ff0000 on a black image gives you 50 % red on black, not 50 % red on the background. I.e. this is not equivalent to iOS template images.

Change the color of a Material icon in Android - Soni Akshay, See the full set of material design icons in the Material Icons Library. in SVG or PNGs, formats that are suitable for web, Android, and iOS projects or for inclusion in any designer tools. Colored, sized and positioned entirely with CSS. @font​-face { font-family: 'Material Icons'; font-style: normal; font-weight: 400; src:  Change google material design icon color example. By using style property we can easily change the color of material design icons. Font Awesome Android

You can use the TintImageView within the appcompat support library and then tinting/coloring the imageview is by simply calling the android:backgroundTint to tint the imageview into one color.


Xml

<TintImageView
android:layout_width=""
android:layout_height="" 
android:src=""
android:backgroundTint="@color/green"/>

or

<ImageView 
android:tint="the_color_you_want"/>

Programatically

ImageView yourImageView = findViewById(...) yourImageView.setColorFilter(Context.getColor(your_color_here))


So the above xml will tint the imageView to color green, means that it will colorize each pixel of the imageview that are visible to green.

Material Icons Guide, The Android Developers site provides detailed documentation on the respective tabs and lets the user quickly change between content views. Alternatively, you can add a TabLayout to a ViewPager in XML: The updated Material TabLayout style consists of updated icon and label tints, ripple color, and ripple shape. The Easier Way would be to right click on drawable -> New-> Vector Image Asset then download your desired Icon, After Downloading open the xml file and change the color to white.YOU MIGHT WANT TO RENAME FROM BLACK

I was looking for the same thing but to change it dynamically in the code. I hope this helps someone looking for the same thing.

Create an ImageView for the icon and use setColorFilter on that view.

ImageView imageViewIcon = (ImageView) listItem.findViewById(R.id.imageViewIcon);
imageViewIcon.setColorFilter(getContext().getResources().getColor(R.color.blue));

Tab Layout, Android's top app bar component APIs provide support for the navigation icon, readers like TalkBack are able to announce their purpose or action, if any. In @​menu/top_app_bar.xml : MaterialToolbar icon color, N/A, N/A ?attr/​colorControlNormal (as Drawable tint) Default style, Widget.Design.​CollapsingToolbar  Material is an adaptable system of guidelines, components, and tools that support the best practices of user interface design. Backed by open-source code, Material streamlines collaboration between designers and developers, and helps teams quickly build beautiful products.

<vector android:height="48dp" android:viewportHeight="24.0"
    android:viewportWidth="24.0" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#ca0f0f" android:pathData="M3,5v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2H5c-1.11,0 -2,0.9 -2,2zm12,4c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3zm-9,8c0,-2 4,-3.1 6,-3.1s6,1.1 6,3.1v1H6v-1z"/>
</vector>

you change color by changing android:fillColor="#ca0f0f"

Top app bars, It also explains how to create and use styles and themes in Android applications Icon filenames are not allowed to contain special character, cannot The Android 5.0 (Lollipop) release was again a radical change with the Material design. colors and fonts, of Android components in XML resource files. Text fields. Text fields let users enter and edit text.. Contents. Using text fields; Filled text field; Outlined text field; Theming; Using text fields. Before you can use Material text fields, you need to add a dependency to the Material Components for Android library.

How to change material icon color in XML

<ImageButton 
     android:layout_width="YourValue"
     android:layout_height="YourValue"
     ...
     android:tint="YourColor" // this line do the magic
/>

Android application design with styles and themes, Material design · Styles and themes · Dark theme · Adaptive icons · Add a To create a new style or theme, open your project's res/values/styles.xml file. For example, here's how to apply the Android Support Library's material design "dark​" start changing these colors, preview your colors with the Material Color Tool. Credit Setup. To use Chips, your project needs to have material components dependency.. implementation 'com.google.android.material:material:1.0.0-beta01' Also set your app theme such that it

Styles and Themes, Material Components (MDC) help developers implement Material Design. Created by a team of engineers and UX designers at Google, MDC features dozens of  As the icon file is in .png format, you should change the color using the tool from which you've created icon. and add it using ImageAsset into project . – satyapol Apr 22 '15 at 8:09 @rajatIIT android:background makes a red box around the icon, and the icon still remains grey in color.

MDC-103 Android: Material theming with Color, Motion and Type , //Material design implementation 'com.google.android.material:material:1.1.0'. Now change your app default app theme in style.xml and change its parent to As you can see how the TextView and Background view behaves We want white icons to appear when the dark theme is selected and black  By default, apps built with Material Components inherit our baseline theme values. To begin customizing, override properties in color.xml, type.xml and shape.xml. type.xml. To change your theme’s typography, we recommend using Google Fonts and choosing a font-family that best reflects your style. Set TextApperances to use your custom font and

Supporting Dark themes in Android, We show you how to change colors, even how to make gradient colors. So add one, we have named mine gradient_normal.xml. You can also check if the icon you want is in material design icons set or search some of the royalty-free sites  See Material Design Icons for a list of available icons. You can also import SVG icons from the material icon library with Android Studio's Vector Asset Studio. Elevation shadows and cards. In addition to the X and Y properties, views in Android have a Z property. This new property represents the elevation of a view, which determines:

Comments
  • Did you try something like android:background="@color/red" ?
  • As the icon file is in .png format, you should change the color using the tool from which you've created icon. and add it using ImageAsset into project .
  • @rajatIIT android:background makes a red box around the icon, and the icon still remains grey in color.
  • What is your minimum target API?
  • in github we have the svg files for the icons, can we derive colour icons from there ?
  • Welcome to Stack Overflow! Please consider editing your post to add more explanation about what your code does and why it will solve the problem. An answer that mostly just contains code (even if it's working) usually wont help the OP to understand their problem. It's also recommended that you don't post an answer if it's just a guess. A good answer will have a plausible reason for why it could solve the OP's issue.
  • if I want to change the drawable left|right icon Tint for EditText TextView there no way to do that I feel! android:backgroundTint="@android:color/holo_blue_bright" not works !!
  • If suppose the icon has to be shown in 200 different colors, then will you put 200 icons with different colors in your drawable?