O'Reilly logo

Android Studio Essentials by Belén Cruz Zapata

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a new layout

When we created our main activity, the associated layout was also created. This is a way of creating a layout when creating an activity.

To add an independent layout without creating a new activity, right-click on the layouts folder (res/layout/) and navigate to New | Layout resource file. You can also navigate to this menu option like this: File | New | Layout resource file. Type the file name and the root element.

Once the layout is created, the associated activity can be changed from the editor to another one. If the layout has no activity, any existing activity can be linked to it from the editor. To accomplish this, search for the Associate with Activity option in the toolbar of the layout editor, click on it, and select ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required