Skip to content

Instantly share code, notes, and snippets.

@NinoDLC
Last active September 5, 2019 20:14
Show Gist options
  • Save NinoDLC/626a8b397d4dbb505d297df270bbfeef to your computer and use it in GitHub Desktop.
Save NinoDLC/626a8b397d4dbb505d297df270bbfeef to your computer and use it in GitHub Desktop.
Toolbar toolbar = findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
mDrawer = findViewById(R.id.main_drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,
mDrawer,
toolbar,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
mDrawer.addDrawerListener(toggle);
toggle.syncState();
mNavigationView = findViewById(R.id.main_navigation_view_menu);
mNavigationView.setNavigationItemSelectedListener(this);
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".controler.articles.ArticlesActivity"
>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
>
<androidx.appcompat.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/main_tl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:tabMode="scrollable"
/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/main_vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/main_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:layout_gravity="bottom|right|end"
app:layout_behavior="fr.delcey.p5.view.ScrollAwareFabBehavior"
app:srcCompat="@drawable/ic_search_white_24dp"
tools:ignore="RtlHardcoded"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/main_navigation_view_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/articles_activity_menu_header"
/>
</androidx.drawerlayout.widget.DrawerLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment