I want to hide the linear layout so i used
LinearLayout mainLayout=(LinearLayout)this.findViewById(R.id.mainLayout); mainLayout.setVisibility(2);
but why is doesn't hide ??!!!
Use with setVisibility(int) and android:visibility . This view is invisible, and it doesn't take any space for layout purposes. Use with setVisibility(int) and android:visibility .
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.
Step 1: Tap on three-dots icon available in the top right side of your post. Step 2: Tap Hide like counts or Hide like and view counts to turn this setting on. Step 3: Tap Unhide Like Counts or Unhide like and view counts to turn this setting off.
Using Linear Layout Inside Relative Layout With Example In Android Studio. Linear Layout can be used inside relative layout since one layout can be nested in other layout in XML.
Use:
mainLayout.setVisibility(LinearLayout.GONE);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With