试图使迷你抽屉从屏幕中间垂直开始
,当我使用自定义CrossFade并将视图添加到其withContent()方法时,我可以这样做
但是当我使用自定义CrossFade时,问题在于它没有添加透明的backGround
所以我遵循了这个图书馆
https://github.com/mikepenz/CrossfadeDrawerLayout
我想改变两个问题
首先,我希望抽屉从屏幕中间开始
第二秒我希望抽屉成为屏幕的一部分
我的意思是打开时不制作阴影或布局
我希望miniDrawer始终存在
这是我的结果
公共静态MiniDrawer initializeDrawer(活动上下文,工具栏工具栏,int mainView, 捆绑了saveInstanceState){
CrossfadeDrawerLayout crossfadeDrawerLayout = new CrossfadeDrawerLayout(context);
Drawer result = new DrawerBuilder()
.withActivity(context)
.withSavedInstance(savedInstanceState)
.withShowDrawerOnFirstLaunch(true)
.withDrawerLayout(crossfadeDrawerLayout)
.withHasStableIds(true)
.withDrawerWidthDp(72)
.withGenerateMiniDrawer(true)
.addDrawerItems(
)
.withSavedInstance(savedInstanceState)
.build();
crossfadeDrawerLayout.setMaxWidthPx(DrawerUIUtils.getOptimalDrawerWidth(context));
MiniDrawer miniResult = result.getMiniDrawer();
View view = miniResult.build(context);
view.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(context, com.mikepenz.materialdrawer.R.attr.material_drawer_background, com.mikepenz.materialdrawer.R.color.material_drawer_background));
crossfadeDrawerLayout.getSmallView().addView(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
crossfadeDrawerLayout.openDrawer(GravityCompat.START);
result.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
return miniResult.withCrossFader(new ICrossfader() {
@Override
public void crossfade() {
crossfadeDrawerLayout.crossfade(400);
if (isCrossfaded()) {
result.getDrawerLayout().closeDrawer(GravityCompat.START);
}
}
@Override
public boolean isCrossfaded() {
return crossfadeDrawerLayout.isCrossfaded();
}
});
}
谢谢你