Using NavigationView from Android Design Support Library -
i'm trying follow this tutorial use new drawerlayout design support library.
it seems android studio isn't recognizing navigationview layout.
this main_activity layout:
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="20dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello"/> </linearlayout> <android.support.design.widget.navigationview android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerlayout="@layout/drawer_header" app:menu="@menu/drawer_menu"/> </android.support.v4.widget.drawerlayout>
and when i'm trying run project, i'm getting next error:
error: (19) no resource identifier found attribute 'headerlayout'
but have drawer_header xml file
my bad!
you should, of course, import android support design lib project.
so 'dependencies' area in gradle (app) should that:
dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:design:22.2.0' }
Comments
Post a Comment