Is yur line layout installed in XML or programmatically?
if it is done in XML:
note that if any views use this view as a link in the layout, such as android: layout_below = "@ + id / this", then this would not be a good idea.
You can use something like this, it will hide all child views and itself, it will not hide, but will completely leave (space is not occupied by it)
Use this as a reference in a class if you want to use it in several ways or in the method that you use.
View layout;
Then in onCreate call this
layout = findViewById(R.id.linearLayout);
:
layout.setVisibility(View.GONE);
layout.setVisibility(8);
layout.setVisibility(View.VISIBLE);
layout.setVisibility(0);