コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_top_level);

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

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

    // Set up the container size of the expanded video player
    final View view = findViewById(R.id.container);
    ViewTreeObserver vto = view.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(
        new ViewTreeObserver.OnGlobalLayoutListener() {
          @Override
          public void onGlobalLayout() {
            mVideoFrag.setContainerSize(view.getHeight(), view.getWidth());
          }
        });

    mVideoFrag = (VideoFragment) getFragmentManager().findFragmentById(R.id.special_fragment);
  }
コード例 #2
0
 @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.
     restoreActionBar();
     return true;
   }
   return super.onCreateOptionsMenu(menu);
 }