0

您好,我正在使用Sherlock库来实现Tabs。在这里,我正在寻找删除顶部的ActionBar,并设置自定义标题布局,而不是它。如何删除操作栏并设置Sherlock的FragmentActivity的自定义标题

我实现了添加Tabs的功能,但无法将定制标题设置为ActionBar.任何方式都可以这样做?

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_pay_stub); 

    // adding action bar tabs to the activity 
    ActionBar mActionBar = getSupportActionBar(); 
    Tab firstTab = mActionBar.newTab().setText(getString(R.string.paystub_current_tab)).setTabListener(this); 
    Tab secondTab = mActionBar.newTab().setText(getString(R.string.paystub_all_tab)).setTabListener(this); 

    // add the tabs to the action bar 
    mActionBar.addTab(firstTab); 
    mActionBar.addTab(secondTab); 

    // set the navigation mode the Action Bar Tabs 
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 

} 

在此先感谢。

回答

0

我通过添加背景颜色和图标ActionBar解决了这个问题。

ActionBar actionBar = getSupportActionBar(); 
setTitle(""); 
actionBar.setIcon(R.drawable.headerlogo); 
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F4A401"))); 
相关问题