Java Code Examples for androidx.appcompat.app.actionbar#setDisplayShowCustomEnabled()
The following examples show how to use
androidx.appcompat.app.actionbar#setDisplayShowCustomEnabled() .
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 android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings_activity); getSupportFragmentManager() .beginTransaction() .replace(R.id.settings, new SettingsFragment()) .commit(); setSupportActionBar(findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); } SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); sharedPreferences.registerOnSharedPreferenceChangeListener(this); }
Example 2
Source File: LogsActivity.java From android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logs); Log.i("Entering " + getClass().getSimpleName()); updateLogs(); setSupportActionBar(findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); } }
Example 3
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 4
Source File: ConversationActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
protected void initializeActionBar() { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar == null) throw new AssertionError(); 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); }
Example 5
Source File: HoneycombUtil.java From shortyz with GNU General Public License v3.0 | 5 votes |
public View onActionBarCustom(AppCompatActivity a, int id) { ActionBar bar = a.getSupportActionBar(); if(bar == null){ return null; } bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowHomeEnabled(true); bar.setCustomView(id); return bar.getCustomView(); }
Example 6
Source File: GingerbreadUtil.java From shortyz with GNU General Public License v3.0 | 5 votes |
public View onActionBarCustom(AppCompatActivity a, int id) { System.out.println("Setting custom ActionBar view"); ActionBar bar = a.getSupportActionBar(); if(bar == null){ return null; } bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowHomeEnabled(true); bar.setCustomView(id); return bar.getCustomView(); }