When using the Android Studio wizard to create a new project, it automatically creates the res/layout/activity_main.xml file (as shown in the following screenshot). It then inflates the XML file in the onCreate() callback with setContentView(R.layout.activity_main):
![](https://static.packt-cdn.com/products/9781788991216/graphics/assets/b1287040-1470-4e57-99f6-72b7def8a274.png)
For this recipe, we will create two slightly different layouts and switch between them with a button.