How to change icon colors in android studio

I downloaded a few badges from the material. But they only offer badges in black. I saw a YouTube video where they use it so you can choose a color. Anyway, I'm trying to change the colors of the icons to white. I was not lucky. I tried changing the fill color in Android studio, but it does not work. Any help would be appreciated, like the exact code and files for adding the code. Thanks.

+6
source share
5 answers

You can directly upload these images to Android Studio.

res> right click> New> Image Object and select

  • Icon Type: Action Bar and Tab Icones
  • Object Type: Clipart
  • Theme: custom

, , , ..

enter image description here

+6

Android: = "@: /"

+7

, material.io Android Studio. , , (res/drawable) , , (hdpi, xhdpi ..).

  • "res"
  • ""
  • " "

Create Vector Icon

  1. "icon"
  2. material.io
  3. ,
  4. ""

  • android: tint ImageView. , .

Layout color change example

  1. Java.

imageView.setColorFilter(ContextCompat.getColor(context, android.R.color.white), PorterDuff.Mode.MULTIPLY);

+4

https://material.io/icons/ .

enter image description here

, , , . ( ), Android Studio : https://github.com/konifar/android-material-design-icon-generator-plugin

It allows you to create material design icons right in Android Studio, no matter what color you want. Another alternative for downloading these icons in different colors is https://materialdesignicons.com/ .

If you want to color the icons at runtime, try something like this:

imageView.setColorFilter(ContextCompat.getColor(context, android.R.color.white), 
        PorterDuff.Mode.MULTIPLY);
+2
source

You can load white icons from the material. also see themes and overlay themes

White material

0
source

Source: https://habr.com/ru/post/1016201/


All Articles