How to remove a View from an xml layout?

Asked

Viewed 318 times

0

for example... I want that when inflating a layout with a certain class, it removes the unnecessary views and uses only the necessary ones... There is a method to remove views?

2 answers

0


I can see two ways to do this. The first is that you can hide the view you want through the method suaView.setVisibility(View.GONE). She’ll still be there, but she won’t be visible. The second is that every layout (Linearlayout, Relativelayout and etc) inherits from Viewgroup, and this class has the method [removeView(suaView)][1].

0

You can set the view visibility to GONE, this 'remove' parameter on the screen

view.setVisibility(View.GONE);

Browser other questions tagged

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