Drawable isn’t picking up images

Asked

Viewed 377 times

2

Guys, I’m making an app that has a Drawer, and the menu that appears laterally is a navigationView. So far so good, but in the code . xml I want to add icons, is not picking up the images.

The code . xml of Drawer looks like this:

<group android:checkableBehavior="single">
    <item
        android:id="@+id/nav_home"
        android:icon="@drawable/ic_menu_camera"
        android:title="Home" /> 

But inside the drawable folder the ic_menu_camera object is not an image but another .xml. code.:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="#FF000000"
    android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path
    android:fillColor="#FF000000"
    android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>

I would like to change this icon but when I add an image . png in the drawable folder and call it that(code below), the image does not appear:

<group android:checkableBehavior="single">
    <item
        android:id="@+id/nav_home"
        android:icon="@drawable/home_icon"
        android:title="Home" />
  • ola, I wonder if you managed to solve this problem , because I’m with the same and need help , thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.