0

Bonjour, J'utilise la bibliothèque Sherlock pour atteindre le Tabs. Ici, je cherche à supprimer le ActionBar en haut et définir la mise en page du titre personnalisé au lieu de cela.Comment supprimer Action Bar et définir le titre personnalisé de FragmentActivity de Sherlock

J'ai atteint une fonctionnalité pour ajouter le Tabs mais je n'ai pas pu définir le titre personnalisé sur ActionBar. Une façon de le faire?

@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); 

} 

Merci d'avance.

Répondre

0

J'ai résolu ce problème en ajoutant une couleur de fond et une icône du ActionBar.

ActionBar actionBar = getSupportActionBar(); 
setTitle(""); 
actionBar.setIcon(R.drawable.headerlogo); 
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F4A401"))); 
Questions connexes