Vishal Chepuri
Vishal Chepuri

Reputation: 320

Android textview hide show toggle

i have created 3 textviews(utilities,bmi,bmr).If i click on utilities, bmi and bmr should toggle(hide/show).How to achieve this. Thankyou in advance

Upvotes: 1

Views: 1740

Answers (1)

royB
royB

Reputation: 12977

TextView utilityOne;

utilityOne.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick (View v) {
                    if(yourViewThatShouldVanish.getVisibility == View.VISIBLE){
                        yourViewThatShouldVanish.setVisibility(View.GONE); 
                    }
                    else{
                       yourViewThatShouldVanish.setVisibility(View.VISIBLE);  
                }
            }
    );

Upvotes: 1

Related Questions