навигация Открытие экрана, когда я нажимаю на кнопку, но не закрытие снова, когда я нажимаю на нее снова. ниже мой код. это мой java код:
toolbar = findViewById(R.id.maintoolbar);
toolbar.setTitleTextAppearance(this, R.style.ActionBarTitle);
// Sets the Toolbar to act as the ActionBar for this Activity window.
// Make sure the toolbar exists in the activity and is not null
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new NavigationIconClickListener(
getBaseContext(),
findViewById(R.id.mainContainer),
new AccelerateDecelerateInterpolator(),
getApplicationContext().getResources().getDrawable(R.drawable.branded_menu), // Menu open icon
getApplicationContext().getResources().getDrawable(R.drawable.close_menu)));
bNavVu = findViewById(R.id.bottom_nav_vu);
final View activityRootView = findViewById(R.id.rootLayout);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
//r will be populated with the coordinates of your view that area still visible.
activityRootView.getWindowVisibleDisplayFrame(r);
int heightDiff = activityRootView.getRootView().getHeight() - (r.bottom - r.top);
if (heightDiff > 100) { // if more than 100 pixels, its probably a keyboard...
hideSystemUI();
}
}
});
if (savedInstanceState == null) {
getSupportFragmentManager()
.beginTransaction()
.add(R.id.mainContainer, new CategoryFragment())
.commit();
}