androidx.appcompat.app.ActionBar#setDisplayShowCustomEnabled ( )源码实例Demo

下面列出了androidx.appcompat.app.ActionBar#setDisplayShowCustomEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android   文件: SettingsActivity.java
@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);
}
 
源代码2 项目: android   文件: LogsActivity.java
@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);
    }
}
 
源代码3 项目: deltachat-android   文件: ProfileActivity.java
@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);
}
 
源代码4 项目: deltachat-android   文件: ConversationActivity.java
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);
}
 
源代码5 项目: shortyz   文件: HoneycombUtil.java
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();
}
 
源代码6 项目: shortyz   文件: GingerbreadUtil.java
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();
}