There is the way to change visibility of View, but how can I change programmatically visibility of layout defined in XML? How to get layout object?
You can change layout visibility just in the same way as for regular view. Use setVisibility(View.GONE) etc. All layouts are just Views, they have View as their parent.