Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevin-kip/drawerslidingcontent
Implementing android navigation drawer where the content moves, instead of the drawer overlaying the content.
https://github.com/kevin-kip/drawerslidingcontent
Last synced: 2 days ago
JSON representation
Implementing android navigation drawer where the content moves, instead of the drawer overlaying the content.
- Host: GitHub
- URL: https://github.com/kevin-kip/drawerslidingcontent
- Owner: Kevin-Kip
- Created: 2018-06-03T09:53:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-08T09:21:51.000Z (over 6 years ago)
- Last Synced: 2024-11-23T15:36:18.445Z (2 months ago)
- Language: Java
- Size: 127 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## DrawerSlidingContent
Implementing android navigation drawer where the content moves, instead of the drawer overlaying the content.## The magic
All you need is the following code```java
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close){
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {//this where the magic happens
super.onDrawerSlide(drawerView, slideOffset);
float slideX = drawerView.getWidth() * slideOffset;
mainPanel.setTranslationX(slideX);
}
};
drawer.setDrawerElevation(0f);//this removes the overlay shadow at the end of the drawer
drawer.setScrimColor(Color.TRANSPARENT);//this removes the dark overlay on content when drawer is open
drawer.addDrawerListener(toggle);
toggle.syncState();
```