Java Code Examples for androidx.appcompat.app.actionbar#setDisplayShowTitleEnabled()
The following examples show how to use
androidx.appcompat.app.actionbar#setDisplayShowTitleEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SettingsActivity.java From c3nav-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); settingsFragment = new SettingsFragment(); getSupportFragmentManager() .beginTransaction() .replace(R.id.settings_container, settingsFragment) .commit(); }
Example 2
Source File: UCropActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * Configures and styles both status bar and toolbar. */ private void setupAppBar() { setStatusBarColor(mStatusBarColor); final Toolbar toolbar = findViewById(R.id.toolbar); // Set all of the Toolbar coloring toolbar.setBackgroundColor(mToolbarColor); toolbar.setTitleTextColor(mToolbarWidgetColor); final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title); toolbarTitle.setTextColor(mToolbarWidgetColor); toolbarTitle.setText(mToolbarTitle); // Color buttons inside the Toolbar Drawable stateButtonDrawable = AppCompatResources.getDrawable(this, mToolbarCancelDrawable).mutate(); stateButtonDrawable.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); toolbar.setNavigationIcon(stateButtonDrawable); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } }
Example 3
Source File: BaseToolbarActivity.java From DevUtils with Apache License 2.0 | 6 votes |
/** * 初始化 ToolBar */ protected void initToolBar() { // = 处理 ActionBar = setSupportActionBar(vid_bt_toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // 给左上角图标的左边加上一个返回的图标 actionBar.setDisplayHomeAsUpEnabled(true); // 对应 ActionBar.DISPLAY_SHOW_TITLE actionBar.setDisplayShowTitleEnabled(false); } // 设置点击事件 vid_bt_toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 关闭页面 finish(); } }); }
Example 4
Source File: BaseMVPToolbarActivity.java From DevUtils with Apache License 2.0 | 6 votes |
/** * 初始化 ToolBar */ protected void initToolBar() { // = 处理 ActionBar = setSupportActionBar(vid_bt_toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // 给左上角图标的左边加上一个返回的图标 actionBar.setDisplayHomeAsUpEnabled(true); // 对应 ActionBar.DISPLAY_SHOW_TITLE actionBar.setDisplayShowTitleEnabled(false); } // 设置点击事件 vid_bt_toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 关闭页面 finish(); } }); }
Example 5
Source File: BaseActivity.java From CloudReader with Apache License 2.0 | 6 votes |
/** * 设置titlebar */ protected void setToolBar(Toolbar toolbar) { setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { //去除默认Title显示 actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.icon_back); } toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { supportFinishAfterTransition(); } }); }
Example 6
Source File: NavigationDrawerFragment.java From bitmask_android with GNU General Public License v3.0 | 5 votes |
private ActionBar setupActionBar() { AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.setSupportActionBar(toolbar); final ActionBar actionBar = activity.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(true); return actionBar; }
Example 7
Source File: BaseActivity.java From MasteringAndroidDataBinding with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayUseLogoEnabled(false); } }
Example 8
Source File: NavigationDrawerFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 9
Source File: ActionBarPreferenceActivity.java From SkyTube with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); setTitle(R.string.preferences); } super.onCreate(savedInstanceState); }
Example 10
Source File: HomeFragment.java From CrazyDaily with Apache License 2.0 | 5 votes |
@Override protected void initView() { setSupportActionBar(mToolbar); ActionBar actionBar = mActivity.getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } mToolbar.setNavigationIcon(R.mipmap.ic_scan); mNavigationIcon = mToolbar.getNavigationIcon(); mHomeList.setLayoutManager(new LinearLayoutManager(mActivity)); mHomeList.setAdapter(mAdapter); mWrapBanner.setOnBannerSlideListener(this::handleWrapBanner); }
Example 11
Source File: WebViewActivity.java From CloudReader with Apache License 2.0 | 5 votes |
private void initToolBar() { setSupportActionBar(mTitleToolBar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { //去除默认Title显示 actionBar.setDisplayShowTitleEnabled(false); } mTitleToolBar.setOverflowIcon(ContextCompat.getDrawable(this, R.drawable.actionbar_more)); tvGunTitle.postDelayed(() -> tvGunTitle.setSelected(true), 1900); tvGunTitle.setText(mTitle); }
Example 12
Source File: NavigationDrawerFragment.java From fragment-navigation with Apache License 2.0 | 5 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(R.string.app_name); }
Example 13
Source File: BaseScannerActivity.java From natrium-android-wallet with BSD 2-Clause "Simplified" License | 5 votes |
public void setupToolbar() { Toolbar toolbar = findViewById(R.id.scan_toolbar); setSupportActionBar(toolbar); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setHomeAsUpIndicator(R.drawable.ic_close); } }
Example 14
Source File: ArticleMVVMActivity.java From DevUtils with Apache License 2.0 | 5 votes |
@Override public void initViews() { super.initViews(); // 因现有架构与 MVVM 并非完全兼容, 需要重新设置 setContentView // 在一开始选型确定后, 才能专门为其设计基类 // MVVM 只需要调用此句绑定 viewDataBinding = DataBindingUtil.setContentView(this, getLayoutId()); // = 处理 ActionBar = setSupportActionBar(viewDataBinding.vidAamToolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // 给左上角图标的左边加上一个返回的图标 actionBar.setDisplayHomeAsUpEnabled(true); // 对应 ActionBar.DISPLAY_SHOW_TITLE actionBar.setDisplayShowTitleEnabled(false); } // 设置点击事件 viewDataBinding.vidAamToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 关闭页面 finish(); } }); Intent intent = getIntent(); // 获取标题 String title = intent.getStringExtra(KeyConstants.Common.KEY_TITLE); // 设置标题 viewDataBinding.setTitle(title); viewDataBinding.setVariable(BR.title, title); // 设置后, 会动态刷新 // 初始化 View View view = viewDataBinding.vidAamState.getView(ViewAssist.TYPE_ING); whorlView = ViewUtils.findViewById(view, R.id.vid_sli_load_view); }
Example 15
Source File: CropRotateFragment.java From cloudinary_android with MIT License | 5 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity != null) { Toolbar toolbar = getActivity().findViewById(R.id.cropRotateToolbar); activity.setSupportActionBar(toolbar); ActionBar actionBar = activity.getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); } } }
Example 16
Source File: LttrsActivity.java From lttrs-android with Apache License 2.0 | 5 votes |
private void configureActionBarForDestination(NavDestination destination) { final ActionBar actionbar = getSupportActionBar(); if (actionbar == null) { return; } final int destinationId = destination.getId(); final boolean showMenu = MAIN_DESTINATIONS.contains(destinationId); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeAsUpIndicator(showMenu ? R.drawable.ic_menu_black_24dp : R.drawable.ic_arrow_back_white_24dp); actionbar.setDisplayShowTitleEnabled(destinationId != R.id.thread); }
Example 17
Source File: ProfileActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle bundle, boolean ready) { setContentView(R.layout.profile_activity); initializeResources(); setSupportActionBar(this.toolbar); ActionBar supportActionBar = getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(false); supportActionBar.setCustomView(R.layout.conversation_title_view); supportActionBar.setDisplayShowCustomEnabled(true); supportActionBar.setDisplayShowTitleEnabled(false); Toolbar parent = (Toolbar) supportActionBar.getCustomView().getParent(); parent.setPadding(0,0,0,0); parent.setContentInsetsAbsolute(0,0); titleView = (ConversationTitleView) supportActionBar.getCustomView(); titleView.setOnBackClickedListener(view -> onBackPressed()); titleView.setOnClickListener(view -> onEnlargeAvatar()); updateToolbar(); this.tabLayout.setupWithViewPager(viewPager); this.viewPager.setAdapter(new ProfilePagerAdapter(getSupportFragmentManager())); dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CHAT_MODIFIED, this); dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CONTACTS_CHANGED, this); }
Example 18
Source File: DetailController.java From klingar with Apache License 2.0 | 5 votes |
@NonNull @Override protected View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) { View view = super.onCreateView(inflater, container); plexItem = getArgs().getParcelable(PLEX_ITEM); ActionBar actionBar = null; if (getActivity() != null) { actionBar = ((KlingarActivity) getActivity()).getSupportActionBar(); } if (actionBar != null) { setHasOptionsMenu(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); if (plexItem instanceof Artist) { actionBar.setTitle(((Artist) plexItem).title()); } else if (plexItem instanceof Album) { actionBar.setTitle(((Album) plexItem).title()); } } recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(true); recyclerView.addItemDecoration(new DividerItemDecoration(itemDivider)); contentLoading.hide(); return view; }
Example 19
Source File: MainActivity.java From android-ads with Apache License 2.0 | 4 votes |
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(title); }
Example 20
Source File: NavigationDrawerFragment.java From bitmask_android with GNU General Public License v3.0 | 4 votes |
/** * Per the navigation drawer design guidelines, updates the action bar to show the global app * 'context', rather than just what's in the current screen. */ private void showGlobalContextActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.app_name); }