NavigationView
显示时如何隐藏shackbar
因此snackbar
不会重叠NavigationView
答案 0 :(得分:2)
您可以使用Snackbar Callbacks
snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
//see Snackbar.Callback docs for event details
...
}
@Override
public void onShown(Snackbar snackbar) {
drawerLayout.closeDrawer(GravityCompat.START);
}
});
答案 1 :(得分:0)
此处有two
方式close your drawer
close
抽屉,animation
就像这样snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
//see Snackbar.Callback docs for event details
...
}
@Override
public void onShown(Snackbar snackbar) {
drawerLayout.closeDrawer(GravityCompat.START);
}
});
close
抽屉没有animation
这样的snackbar.addCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
//see Snackbar.Callback docs for event details
...
}
@Override
public void onShown(Snackbar snackbar) {
drawerLayout.closeDrawer(GravityCompat.START,false);
}
});