我正在开发一个带有导航抽屉的android应用程序.一切正常.除了当我开始我的应用程序时,抽屉自动出现.这是我试图解决这个问题的方法:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager() .findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mNavigationDrawerFragment.setUp(R.id.navigation_drawer, mDrawerLayout); // as a solution I added this if-statement if(mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawers(); } setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }
但它不起作用!.一旦applilication开始,如何隐藏它?
mDrawerLayout.closeDrawer(GravityCompat.START);