May 5, 2017
Nativescript: Actionbar with Android Material Design Icons
Have you ever wondered how you can get a Action Bar like this one in Nativescript?
It’s easy:
I hope you have Android Studio preinstalled, you need it. Create and open a example Android Project with Android Studio.
Now Right-Click on your Project Folder, select New -> Vector Asset which opens a new Dialog.
You can select the Icon you want and click Next. Note the path, where the file is saved.
In your NativeScript Project create a new folder App_Resource/Android/drawable, copy your xml file from your android project into this folder.
Now you can use the file in NativeScript:
1 2 3 |
<ActionBar class="action-bar" title="TestTitle"> <ActionItem icon="res://ic_android_black_24dp" (tap)="doSth()"></ActionItem> </ActionBar> |
Restart the build and give it a try.