Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The colored image turned to have no color and just a grey vector in drawable?

I have created a new Image Assets in the Drawable cus I need to insert a new image in my app, but every time I create a new image asset, the output turns to be no colour at all. I've attached the pic of it.enter image description here

It's confusing and whenever I import it in my layout, it's just grey all over as you can see in the image. Why is it cus I can't find any ready solutions? Let me know if I'm overlooked.

like image 638
Ben Scmidth Avatar asked Mar 21 '16 22:03

Ben Scmidth


People also ask

How do I change the color of a vector drawable path on button click?

The color of the whole vector can be changed using setTint. Then to change the color of your image: DrawableCompat. setTint(myImageView.

How do you insert a picture into drawable?

To import image resources into your project, do the following: Drag and drop your images directly onto the Resource Manager window in Android Studio. Alternatively, you can click the plus icon (+), choose Import Drawables, as shown in figure 3, and then select the files and folders that you want to import.

Which of the following is a drawable object that manages an array of other Drawables with the last drawable on the top of list?

Layer list. A LayerDrawable is a drawable object that manages an array of other drawables. Each drawable in the list is drawn in the order of the list—the last drawable in the list is drawn on top.

What is v24 in android drawable?

Classic drawable resources such as images are stored in the drawable folder. In contrast, vector drawables are stored in drawable-v24 . For this project, keep the drawable default and click OK. You should now see the New File dialog box.


3 Answers

I got the answer for my own question which I find it's useful for some who still do not know how to enable the Batch Drawable Import. It's easy and just need to download plugin and install. I've read that the latest version already has it and I've downloaded and reinstalled, but it didn't show as what I was expecting. The solution is to download and install it.

  1. First, In Android Studio, go to Default Setting File --> Setting or you can simple Click the SDK Manager Icon enter image description here

  2. In the Default Setting, go to Plugins enter image description here

  3. In the search option, type Batch Drawable Import and you'll see there's Android Drawable Importer. enter image description here

  4. In my image, it's already installed, Click Install Plugin and just follow the instructions.

  5. You'll have to restart Android Studio and try to create a new Batch Drawable Import and you'll find it there. ;) Thanks. enter image description here

like image 141
Ben Scmidth Avatar answered Oct 27 '22 00:10

Ben Scmidth


While creating a new asset in the drawable folder you need to set the

"Launcher icons"

in the

"Asset Type "

drop down enter image description here

This will add the images in their original color and will not be greyed out. Also it is possible it adds the images in res/mipmap folder. You can move the images from mipmap folder to anywhere you want.

like image 30
Shadab Ansari Avatar answered Oct 27 '22 00:10

Shadab Ansari


I Found the proper solution! You just have to add this code where you created your NavigationView object!

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    //add the line below and your icon will display as your .svg file
    navigationView.setItemIconTintList(null);
    navigationView.setNavigationItemSelectedListener(this);
like image 40
Mr. Jay Patel Avatar answered Oct 27 '22 01:10

Mr. Jay Patel