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); }
private void initTheme() { setTheme(mPickOptions.themeResId); mToolbar = new Toolbar(new ContextThemeWrapper(mPickOptions.context, Util.getToolbarThemeResId(this))); mToolbar.setPopupTheme(mPickOptions.popupThemeResId); }