i using new android support design library. have followed demo on android developer blogspot except use fragment recyclerview instead of putting both in same xml.
here's activity_main.xml
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/drawer_layout" > <android.support.design.widget.coordinatorlayout android:layout_height="match_parent" android:layout_width="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <include layout="@layout/toolbar"/> </android.support.design.widget.appbarlayout> <framelayout android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="fill_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> </android.support.design.widget.coordinatorlayout> <fragment android:id="@+id/navigation_drawer" android:layout_margintop="?android:attr/actionbarsize" android:name="aungkyawpaing.yangonuniversity.fragments.navigationdrawerfragment" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start|left" tools:layout="@layout/fragment_navigation_drawer"/> </android.support.v4.widget.drawerlayout>
this toolbar.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/my_awesome_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:background="?attr/colorprimary" android:minheight="?attr/actionbarsize" app:layout_scrollflags="scroll|enteralways" app:popuptheme="@style/themeoverlay.appcompat.light" app:theme="@style/themeoverlay.appcompat.dark.actionbar"/> , fragment has recyclerview <android.support.v7.widget.recyclerview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/department_list" android:layout_width="match_parent" android:layout_height="match_parent" />
i have add latest support library dependency in gradle. have seen person saying doesn't work because used list view in fragment, i'm using recyclerview suggested.
okay, might looks stupid have add in dependency
compile 'com.android.support:recyclerview-v7:22.2.0'
Comments
Post a Comment