类似 DrawerLayout 的 ViewGroup,其中“抽屉”隐藏在内容视图下方,可以通过移动内容视图来使抽屉可见。
类似 DrawerLayout 的 ViewGroup,其中“抽屉”隐藏在内容视图下方,可以通过移动内容视图来使抽屉可见。
该库是一个类似 DrawerLayout 的 ViewGroup,其中“抽屉”隐藏在内容视图下方,可以通过移动内容视图来使抽屉可见。它不提供抽屉构建器。
将其添加到你的依赖项块中。
compile 'com.yarolegovich:sliding-root-nav:1.1.1'请参阅示例应用以了解库的使用示例。
View。setContentView)。View。onCreate 中注入菜单。你可以指定内容视图的变换效果,或使用默认变换。new SlidingRootNavBuilder(this)
.withMenuLayout(R.layout.menu_left_drawer)
.inject();你可以使用 SlidingRootNavBuilder 指定根视图的变换效果。
new SlidingRootNavBuilder(this)
.withDragDistance(140) //Horizontal translation of a view. Default == 180dp
.withRootViewScale(0.7f) //Content view's scale will be interpolated between 1f and 0.7f. Default == 0.65f;
.withRootViewElevation(10) //Content view's elevation will be interpolated between 0 and 10dp. Default == 8.
.withRootViewYTranslation(4) //Content view's translationY will be interpolated between 0 and 4. Default == 0
.addRootTransformation(customTransformation)
.inject();上述示例中的 customTransformation 是一个用户创建的类,它实现了 RootTransformation 接口。有关示例,请参阅默认转换。
new SlidingRootNavBuilder(this)
.withMenuOpened(true) //初始菜单打开/关闭状态。默认值为 false
.withMenuLocked(false) //如果为 true,用户无法打开或关闭菜单。默认值为 false。
.withGravity(SlideGravity.LEFT) //如果为 LEFT,你可以从左向右滑动菜单暂无开放 Issues,或尚未同步最近议题。