コード例 #1
0
  private void addToolbarToLayout() {
    final AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);

    final AppBarLayout.LayoutParams toolbarParams =
        new AppBarLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, Util.getActionBarHeight(this));
    toolbarParams.setScrollFlags(
        AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
            | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);

    appBarLayout.addView(mToolbar, toolbarParams);

    setSupportActionBar(mToolbar);
  }
コード例 #2
0
 private void initTheme() {
   setTheme(mPickOptions.themeResId);
   mToolbar =
       new Toolbar(new ContextThemeWrapper(mPickOptions.context, Util.getToolbarThemeResId(this)));
   mToolbar.setPopupTheme(mPickOptions.popupThemeResId);
 }