What is the best way to hide layout on button press,i.e, hide a linear layout where main.xml contains many linear layouts or is it to be done by some other layout please let me know
Below i have given an example of two linear layouts my question is
1.IS it correct
2on browse button press show linear layout2 ,hide linear layout1 and on send button press show linear layout1, hide linear layout2
Show me the relevant code to achieve this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:text="Browse" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:text="Send" android:id="@+id/send" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
To show it again call:
To make it as if it’s not there call:
The xml attribute to make a View visible, invisible, or gone is:
The difference between “invisible” and “gone” is that “invisible” will not be shown but the rest of the layout will stretch or move as if it is there. A view with a “gone” attribute will act as if it doesn’t exist, but you can still change/manipulate it in case you want it seen eventually.