简体   繁体   中英

Android Navigation drawer transparent bug

I have an issue using the navigation drawer in combination with the AR-Fragment from googles arcore sdk, here's a screenshot: 截屏

When I change the current fragment it works as intended. Code inside the onCreate-Method of the Activity:

drawerLayout = findViewById(R.id.activity_main);
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close);
drawerLayout.addDrawerListener(actionBarDrawerToggle);
actionBarDrawerToggle.syncState();

navigationView = findViewById(R.id.navigation_view);
navigationView.setNavigationItemSelectedListener(this);
drawerLayout.bringToFront();
navigationView.bringToFront();

arFragment = new ArSceneFragment();
getSupportFragmentManager().beginTransaction().replace(
                R.id.fragment_container, arFragment).commit();

Hope you can help me:) Thank you and best regards!

EDIT: When I test using the emulator it works perfectly.

try using

if (!drawerLayout.isDrawerOpen(GravityCompat.START)) {
   drawerLayout.openDrawer(Gravity.START);
} else {
   drawerLayout.closeDrawer(Gravity.END);
}

when you open and close the drawer.

and i'm still suspecting the title bar.
Cuz i had a almost same problem before and it was about title bar.
Sometimes eventho you set the theme as NoActionBar in your layout xml, the Manifest file doesn't automatically updates it. so you need to check it twice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM