Android - customizing actionbar sherlock tabs

后端 未结 2 2085
半阙折子戏
半阙折子戏 2020-12-14 03:50

Im trying to customize the actionbar sherlock tabs so they display the tab text below the tab icon. After searching and reading about the subject, I\'m still not having much

2条回答
  •  -上瘾入骨i
    2020-12-14 04:12

    I have solved that by using a compound drawable:

    tv = new TextView(this);
    tv.setText(R.string.tab_movies);
    tv.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.nav_movies, 0, 0);
    
    mBar.addTab(mBar
        .newTab()
        .setCustomView(tv)
        .setTabListener(
        new TabListenerImpl(this, "theaters",
            TheatersTabActivity.class)));
    

    In order to deal with the selected or not selected image, I am using a selector:

    
    
        
        
    
    

提交回复
热议问题