Skip to content

Repository files navigation

SimpleDrawerLayout

This library provides a way to create simple or complex drawer implementations in a single layout!

How to

Gradle

dependencies {
implementation 'com.creativesource:simpledrawerlayout:0.1.0'
}

In your XML layout

<com.creativesource.simpledrawerlayout.SimpleDrawerLayout
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:id="@+id/simple_drawer_layout"android:layout_width="match_parent"android:layout_height="match_parent"app:headerLayout="@layout/header"app:menuRes="@menu/menu"app:drawerGravity="start">

Custom Attributes

AttributeDescription
headerLayoutLocation of header layout resource
drawerItemWhether or not to place layout item inside the drawer (default - false)
drawerGravityDetermines which direction drawer opens (default - Gravity.START)
menuResLocation of menu resource

In your Java code

simpleDrawerLayout = (simpleDrawerLayout) findViewById(R.id.simple_drawer_layout);
simpleDrawerLayout.setNavigationItemSelectedListener(newNavigationView.OnNavigationItemSelectedListener() {
@OverridepublicbooleanonNavigationItemSelected(@NonNullMenuItemmenuItem) {
menuItem.setChecked(true);
simpleDrawerLayout.closeDrawers();
returntrue;
}
});

Custom Methods

MethodDescription
setNavigationItemSelectedListener
(OnNavigationItemSelectedListener navigationListener)
Sets drawer navigation item listener
openDrawer(int gravity)Opens drawer
closeDrawers()Closes drawer

License

Copyright 2019 Jantz Carney
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Simplified & customizable Android DrawerLayout.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages