0

I need to changing alpha of the drawables of my tabs when I click between my tabs in TabHost. I do it like this:

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

Current Activity determines successfully, but alpha is changing only if I turn over the device. Tell me please how can I resolve this issue?

1 Answers1

0

maybe you should try:invalidate() after setting your new alpha values

Tom Mekken
  • 1,019
  • 1
  • 12
  • 27