NavigationView 打开时如何隐藏 snackbar?
How hide snackbar when NavigationView open?
如何在 shackbar
显示时隐藏 NavigationView
?
这样 snackbar
就不会重叠 NavigationView
您可以使用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);
}
});
试试这个
这里有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);
}
});
如何在 shackbar
显示时隐藏 NavigationView
?
这样 snackbar
就不会重叠 NavigationView
您可以使用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);
}
});
试试这个
这里有
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);
}
});