Configuring MainActivity for Portrait Orientation

In general, most apps should support both portrait and landscape orientations. In portrait orientation, the device’s height is greater than its width. In landscape orientation, the device’s width is greater than its height. In the Tip Calculator app, rotating the device to landscape orientation on a typical phone would cause the numeric keypad to obscure most of the Tip Calculator’s GUI. For this reason, you’ll configure MainActivity to support only portrait orientation. In the Android Manifest editor’s Attributes for com.deitel.tipcalculator.MainActivity section, scroll down to the Screen orientation option and select portrait.

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.