0
当我在TabHost中的标签之间点击时,我需要改变我的标签页的drawables的alpha值。我这样做:Drawables Alpha改变TabHost标签切换
getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
Activity currentActivity = getCurrentActivity();
Log.i("choosed activity", currentActivity.toString());
if (currentActivity instanceof LoginActivity) {
Log.i("current activity", "LoginActivity");
getResources().getDrawable(R.drawable.login).setAlpha(255);
getResources().getDrawable(R.drawable.signup).setAlpha(80);
getResources().getDrawable(R.drawable.close).setAlpha(80);
}
if (currentActivity instanceof RegisterActivity) {
Log.i("current activity", "RegisterActivity");
getResources().getDrawable(R.drawable.login).setAlpha(80);
getResources().getDrawable(R.drawable.signup).setAlpha(255);
getResources().getDrawable(R.drawable.close).setAlpha(80);
}
});
当前活动确定成功,但alpha只在我翻过设备时才会改变。请告诉我,我该如何解决这个问题?