1

I followed a template on android studio to create a navigation drawer app. As you know it creates an initial activity with a floating action button and the email icon in it. I just want to change it to a plus sign. Here is the problem. It turns out there is no plus sign available as the ones I can see in every single example ( There is just one I can use but then the plus sign color is green, and I want it white! ).

I followed this steps how to download Material icons , I get the icon ic_plus, and I put every single file in its correspondent folder ( drawables, drawables-hdpi... ).

Problem is when I try to use it here:

The name turns red as it can't find it. As I said, I copied all files one by one to its correspondent drawable folder. I even tried this drawable importer but the same happen.

What am I missing? And why plus sign icon it is not shipped as default icon, as for example the e-mail icon is, as I can see it in every single app using floating action button? I use Android Studio 1.5. Thank you!

EDITED

Looks like images are correctly placed in correspondent folders because if I try to use it on menu bar, I can find it through @drawables/ . Still don't know why I can't do the same for the floating action button. Ideas?

Community
  • 1
  • 1
Asaak
  • 477
  • 1
  • 6
  • 15
  • just to clear things up, the `*.png` image is in `drawables` folder and in the `android.support.design.widget.FloatingActionButton` tag under the `android:src` attribute, you are using `@drawables/imagename.png` and it is still not working? – Sajib Acharya Nov 28 '15 at 11:44
  • On every folder under drawables ( hdpi, mdpi....) I have the corresponding image.png. When I call it on FloatingActionButton as you said ( @drawables/..... It is not able to find the image. Howerver, funny thing is that if for example I want to use this png in toolbar icon, then I can. – Asaak Nov 28 '15 at 15:10
  • That ... is weird. I actually tried this and for me everything is working fine. Do two things - first, under only the `drawables` folder (**not -hdpi** and all), place your image and try using `@drawables`. Next, even if that doesn't work, try `@drawables` and when it shows error, try `cleaning` and `rebuilding` your project. Sometimes the `R.java` messes up. I am guessing that may be the problem. Do get back to me with your results. – Sajib Acharya Nov 28 '15 at 15:23
  • I did exactly what you said and still have the same problem. I've tried downloading the 24dp *.png file and inserting it manually on @drawables. Then, I go to FloatingActionButton and try to locate it but I can't. Weird think though, I can use the downloaded resource for example as a menu icon, toolbar icon....but not in floatingactionbutton. – Asaak Nov 30 '15 at 16:04
  • Just find out that if I store the *.png in @mipmap then I can use it. I don't know why works this way and it is not working as it is explained in all tutorials I've seen... – Asaak Nov 30 '15 at 17:33

1 Answers1

1

Put your image in the drawable folder.

Use the design editor and when you click on the FAB scroll down to the src and click that little square button with 3 dots on the right side to pull up all your options. You should be able to search for the name of the icon you uploaded and select it from here.

I tried to type in my file name using text editor and it couldn't find my image either.

HarrisonT
  • 41
  • 5
  • Thanks for this. I was confused because the syntax of the attribute value went from `"@android:drawable/ic_dialog_email"` to `"@drawable/ic_shopping_cart"`. I guess the `@android:` is there because it references some kind of preset icon? There is no email icon anywhere in the project when I create it from scratch using the Basic Activity template. – Matt Gregory Oct 03 '19 at 00:40