O'Reilly logo

Android™ Tablet Application Development For Dummies® by Donn Felker

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

Understanding Layouts

Now that you have created the Screen Brightness Toggle application inside Eclipse, you can begin to design the application's user interface. Because the user interface is the part of your application with which your users interact, you must make this area of the application as quick and responsive as possible in all regards.

For the Screen Brightness Toggle application, all you need is a single button centered in the middle of the screen to toggle the screen brightness. Directly below the button you can include some text that lets the user know whether the tablet is in regular daytime mode or in night mode. (See Figures 6-2 and 6-3, respectively.)

Figure 6-2: The Screen Brightness Toggle application in daytime mode (100% screen brightness).

image

Figure 6-3: The Screen Brightness Toggle application in night mode (20% screen brightness).

image

Understanding the XML layout file

All layout files for your application are stored in the res/layouts directory of your Android project in Eclipse. Android Development Tools (ADT) creates a default layout file when you create a new application. When you created the Screen Brightness Toggle application, the ADT created a file in the res/layouts directory named main.xml.

Open that file by double-clicking it, and the XML code appears ...

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