Created
May 29, 2018 06:22
-
-
Save nesterchung/7e0d752af081dd57da9e0a57c85bb3a7 to your computer and use it in GitHub Desktop.
drawerlayout scroll to top
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val toggle = object : ActionBarDrawerToggle(this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { | |
override fun onDrawerClosed(drawerView: View?) { | |
super.onDrawerClosed(drawerView) | |
val recyclerView = navigationView.getChildAt(0) as RecyclerView | |
recyclerView.layoutManager.scrollToPosition(0) | |
} | |
} | |
drawer_layout.addDrawerListener(toggle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment