hi i want below java code c# please help me thank you.

sravankumarsravankumar INMember ✭✭

tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        public void onTabChanged(String tabId) {
              for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
                {
                    tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#5858FA")); //unselected
                }
                tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#2E2EFE")); // selected             
        }
    });

Best Answer

Answers

  • StevenTheEvenStevenTheEven SEMember ✭✭✭
    edited May 2013

    Not working code but it fixes some problems for you.

    public void onTabChanged(String tabId) { for(int i=0;i<tabHost.TabWidget.ChildCount;i++) { tabHost.TabWidget.GetChildAt(i).SetBackgroundColor(Color.ParseColor("#5858FA")); } tabHost.TabWidget.GetChildAt(tabHost.CurrentTab).SetBackgroundColor(Color.ParseColor("#2E2EFE")); }

  • sravankumarsravankumar INMember ✭✭

    hi Tobias Heller your solutin was perfect.

    but i used TabHost instead of "th"(im getting null reference)

    and you told there are better ways like "StateListDrawable"

    can you please explain more easier ways to solve this problem

    thank you

Sign In or Register to comment.