setContentView () method


setContentView (R.layout.main) in the Android inside, What does it mean?

R.layout.main a layout file that is how the controls are placed on how displayed, setContentView display interface is to set an Activity, this sentence is to set the words of the then main Activity using layout files under R.layout layout
Make
SetContentView with dynamic switching may be displayed in View Activity in this way, no more Activity can be displayed different interface, thereby eliminating the need
Transferring data between the variables can be referenced directly Activity. However, the android SDK to build our default Hello
World program, the call is setContentView (int 
layoutResID) method, if you use this method to switch view, and then switch back to the switch, you can not switch the display looks like before and after the modification, that is, equivalent to redisplay a view, and
Non-hidden is the original view before displaying. In fact setContentView is a multi-state approach, we can first use LayoutInflater introduced into the layout xml file
View objects, and through setContentView (View view) to switch views showing a method. Because all modifications are saved in View View object inside, so when you switch back to the original view, you can display directly look after the original modification.

Guess you like

Origin blog.csdn.net/liuhongbin2011net/article/details/46626069