setVisibility(GONE) view becomes invisible but still occupies space

后端 未结 13 2017
我在风中等你
我在风中等你 2020-12-03 03:56

I\'ve got a view that is effectively is a button. Here is its XML layout (add_new.xml)




        
13条回答
  •  感动是毒
    2020-12-03 04:41

    If this is stil needed, there is a great way to deal with it:

    parentView.removeView(childView);
    

    here an example:

    final WhatEverLayout parentView, childView;
    parentView = (WhatEverLayout)findViewById(R.id.parentView_xml);
    childView =(WhatEverLayout)findViewById(R.id.childView_xml);
    parentView.removeView(childView);
    

提交回复
热议问题