当我使用视图作为标签规格标签时,视图与选择标签时相同。Android:使用不同的标签和标签状态视图
有什么办法可以使用不同的视图,就像我们对选定的选项卡使用不同的drawable(选择器)时一样?
我已经尝试过使用选择器,但它只允许更改图标。我想要的是使用自定义视图,并且仍然可以针对不同的选项卡状态使用不同的视图。
这里是我的代码:
View profilInd = getLayoutInflater().inflate(R.layout.tabs_profil_layout, null);
Intent profilIntent = new Intent(this, MyProfilActivity.class);
tabHost.addTab(tabHost.newTabSpec("profil").setIndicator(profilInd).setContent(profilIntent));
的tabs_profil_layout布局是一个简单的LinearLayout用的ImageView和一个TextView。
[这个答案包含这两个州的例子,看看这个(http://stackoverflow.com/a/6992662/593709) –