how to hide linearlayout from java code? [closed]
Solution 1:
Use:
mainLayout.setVisibility(LinearLayout.GONE);
Solution 2:
You can also set the visibility in your layout.xml if you want it hidden when your application first starts.
android:visibility="gone"
should do the trick. This way it is hidden from the very start when the layout is initialized by your app.
Solution 3:
Also you can use LinearLayout.INVISIBLE.
The difference is (Android Documentation):
View.GONE - This view is invisible, and it doesn't take any space for layout purposes.
View.INVISIBLE This view is invisible, but it still takes up space for layout purposes.
You can choose anyone based upon your design.