Set the properties of layout to apply to Android view Setvisibility
There are three values visibility VISIBLE, INVISIBLE, GONE.
Visible invisible invisible, without occupying layout space
Java code
- Set display
- Tv_main_title.setvisibility (view.visible);
- Settings do not display or occupy space
- Tv_main_title.setvisibility (View.gone);
- Setting does not display but takes up space
- Tv_main_title.setvisibility (view.invisible);
Set display tv_main_title.setvisibility (view.visible);//settings do not display or occupy space tv_main_title.setvisibility (view.gone);// Settings do not display but Occupy space tv_main_title.setvisibility (view.invisible);
It is best to implement this interface View.onclicklistener,onclick event
For the use of the display part of layout can use this method, set the layout of the part of the ID, and then set up the corresponding view, and then use setvisibility, set parameters, to achieve the purpose.
Private View TESTBT;
TESTBT = Mtestview.findviewbyid (R.ID.TESTBT);
Testbt.setvisibility (view.invisible);
, there is another way to divide layout into parts, set the ID separately, and display the relevant part according to the ID.
Android footstep---Set layout hidden properties