android layout hide/show views

后端 未结 3 1431
余生分开走
余生分开走 2021-01-12 08:18

I have a linear vertical layout as below. I need in my application to switch the Button and the TextView. To hide button and show text then change etc. If I use setVisibilit

相关标签:
3条回答
  • 2021-01-12 08:54

    You should used setVisibility(View.GONE) instead of setVisibility(View.INVISIBLE).

    For more information go to: http://developer.android.com/reference/android/view/View.html

    0 讨论(0)
  • 2021-01-12 08:57

    use-

    button.setVisibility(View.GONE);
    
    0 讨论(0)
  • 2021-01-12 09:13

    Suppose your created button is as follows...

    Button button = (Button) findViewById(R.id.stopButton);
    

    When you want to hide that Button write this...

    button.setVisibility(View.GONE);
    

    And when you want to show that button again then write...

    button.setVisibility(View.VISIBLE);
    
    0 讨论(0)
提交回复
热议问题