0
如何更改第一个片段中定义的选项卡图标,我想从第二个片段更改它?更改第一个选项卡图标
我给你选项卡,图标和标题如下图所示,现在我想从另一个片段
final TabWidget tabWidget = mTabHost.getTabWidget();
for (int i = 0; i < tabWidget.getTabCount(); i++)
{
final View tab = tabWidget.getChildTabViewAt(i);
final TextView title = (TextView) tab.findViewById(android.R.id.title);
title.setTextSize(9);
title.setTextColor(Color.WHITE);
title.setGravity(Gravity.CENTER);
if(i==0)
{
title.setCompoundDrawablesWithIntrinsicBounds(null, null, null, res.getDrawable(R.drawable.rsz_chat_blue));
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
title.setText(""); // Landscape mode
}
}
if(i==1)
{
title.setCompoundDrawablesWithIntrinsicBounds(null, null, null, res.getDrawable(R.drawable.rsz_contacts_blueg));
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
title.setText(""); // Landscape mode
}
}
if(i==2)
{
title.setCompoundDrawablesWithIntrinsicBounds(null, null, null, res.getDrawable(R.drawable.rsz_play_blue));
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
title.setText(""); // Landscape mode
}
}
if(i==3)
{
title.setCompoundDrawablesWithIntrinsicBounds(null, null, null, res.getDrawable(R.drawable.rsz_settings_blue));
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
{
title.setText(""); // Landscape mode
}
}
}