8.4.6. MainActivity’s Layout: activity_main.xml

You’ll provide two layouts for MainActivity—one for phone-sized devices in the res/layout folder and one for tablet-sized devices in the res/layout-large folder. You’ll need to add the layout-large folder.

Phone Layout: activity_main.xml in res/layout

For the phone layout, open activity_main.xml in the res/layout folder. Set the FrameLayout’s Id to @id/fragmentContainer. This FrameLayout will be used on phones to display the app’s Fragments. Set the Padding Left, Padding Right, Padding Top and Padding Bottom properties for the FrameLayout as you did for other layouts in earlier chapters.

Tablet Layout: activity_main.xml in res/layout-large

For the tablet layout, create a new activity_main.xml ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.