Click one button and make another appear

Asked

Viewed 67 times

1

How do I click on botao1 and do the botao2 and botao3 appear on the screen? I left the botao2 and the botao3 visibility = invisible.

1 answer

2


This is simple to do, just use the onClick of botao1 to make others appear?

botao1.setOnClickListener( new OnClickListener( ) 
{
    @Override
    public void onClick( View v ) 
    {
         botao1.setVisibility( View.GONE    );  //desaparece o 1
         botao2.setVisibility( View.VISIBLE );  //aparece o 2 
         botao3.setVisibility( View.VISIBLE );  //aparece o 3
    }
});
  • 1

    Thank you... the logic I had of how it was, I just didn’t know I had to put View but thank you.

  • How so? View.Gone is just a static value to use in the function.

  • that part I didn’t know, I thought it was setVisibility(Visible)

  • @Nathan when it’s like that just see the function API and you get all this information ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.