コード例 #1
0
ファイル: MainActivity.java プロジェクト: nhtechip/MyApp
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   if (!mNavigationDrawerFragment.isDrawerOpen()) {
     // Only show items in the action bar relevant to this screen
     // if the drawer is not showing. Otherwise, let the drawer
     // decide what to show in the action bar.
     getMenuInflater().inflate(R.menu.main, menu);
     restoreActionBar();
     return true;
   }
   return super.onCreateOptionsMenu(menu);
 }
コード例 #2
0
ファイル: MainActivity.java プロジェクト: nhtechip/MyApp
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }