I\'ve got a view that is effectively is a button. Here is its XML layout (add_new.xml)
What you can do is set an if statement, whenever the condition to set the visibility to "GONE", set the view as wrap content and your space will be free, I did it and it worked for a seekbar