Reputation: 2121
So, basically I'm creating a new Vector Asset using a particular material icon (in this case navigation menu icon).
And after that, I want to try that new icon in my FloatingActionButton
, but, silly enough, the asset I just created doesn't detected by Android Studio, and returned an error like the screenshot below.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_white_24dp" />
I also tried to add .xml
to the end of the code and copying the file reference and pasted it in the code, but both doesn't work.
Then I decided to look at the error details, which is:
java.lang.NumberFormatException: Color value '@android:drawable/ic_menu_white_24dp' must start with #
And then I think, "oh! maybe I forgot the #". So, I opened the xml file, only to find that I already wrote the #.
<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="#FFFFFF"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
So, is there anyone find what did I do wrong? I'm new to AS, and Android Dev, so I might missed something silly though.
P.S. I also tried to reopen Android Studio, and rebuild my project, but it's no good.
P.S.S. I'm using Android Studio 2.1
Upvotes: 1
Views: 2424
Reputation: 7415
It is actually @drawable/ic_menu_white_24dp
Or If you are supporting the native Vector version you can use.
app:srcCompat:@drawable/ic_menu_white_24dp
Upvotes: 2
Reputation: 35661
you have included the android namespace in your markup. As the drawable you are trying to use is not part of the Android framework (it is YOUR drawable folder), this part is not required.
e.g just use: @drawable/ic_menu_white_24dp.xml
Upvotes: 0