Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void createNavDrawerItems() {
- mDrawerItemsListContainer = (ViewGroup) findViewById(R.id.navdrawer_items_list);
- ...
- int i = 0;
- for (int itemId : mNavDrawerItems) {
- mNavDrawerItemViews[i] = makeNavDrawerItem(itemId, mDrawerItemsListContainer);
- mDrawerItemsListContainer.addView(mNavDrawerItemViews[i]);
- ++i;
- }
- }
- private View makeNavDrawerItem(final int itemId, ViewGroup container) {
- ...
- if (itemId == NAVDRAWER_ITEM_SEPARATOR) {
- layoutToInflate = R.layout.navdrawer_separator;
- } else if (itemId == NAVDRAWER_ITEM_SEPARATOR_SPECIAL) {
- layoutToInflate = R.layout.navdrawer_separator;
- } else {
- layoutToInflate = R.layout.navdrawer_item;
- }
- ...
- return view;
- }
- <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">
- <!-- your content layout -->
- <android.support.design.widget.NavigationView
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:layout_gravity="start"
- app:headerLayout="@layout/drawer_header"
- />
- </android.support.v4.widget.DrawerLayout>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:choiceMode="singleChoice"
- android:orientation="vertical">
- <TextView
- android:id="@+id/myFirstButton"
- android:onClick="onMyFirstButtonClick"
- android:text="@string/my_first_button_title"/>
- <TextView
- android:id="@+id/goToTheTopButton"
- android:onClick="onGoToTheTopButtonClick"
- android:text="@string/go_to_the_top_title"/>
- <View style="@style/Divider"/>
- <!-- Some other "menu items" -->
- </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement