dynamically add remove control form linearlayout

后端 未结 4 2062
一个人的身影
一个人的身影 2021-01-05 11:15

I have 3 layouts, I need when click on button access certain layout and ad remove controls from and in it any idea how to achieve that , this is the code I use



        
4条回答
  •  余生分开走
    2021-01-05 12:01

    Look at the setVisibility method of the View class. It allows you to make Views appear or disappear from the UI very simply.

    In your button's click listener just add view.setVisibility(View.GONE) to make any layout or widget go away. You can make it reappear by calling view.setVisibility(View.VISIBLE)

提交回复
热议问题