Previewing the Application in the Visual Designer
That's it! You've created your layout for this application!
The full code for your layout is as follows:
<?xml version=“1.0” encoding=“utf-8”?> <RelativeLayout xmlns:android= “http://schemas.android.com/apk/res/android” android:layout_width=“match_parent” android:layout_height=“match_parent” > <TextView android:layout_width=“wrap_content” android:layout_height=“wrap_content” android:text=“ Press the toggle button to toggle the screen brightness between 20 and 100% (night and day time)” android:layout_centerHorizontal=“true”/> <ToggleButton android:id=“@+id/toggleButton” android:layout_width=“wrap_content” android:layout_height=“wrap_content” android:layout_centerInParent=“true” android:textOn=“Dimmer On” android:textOff=“Dimmer Off”/> <TextView android:text=“TextView” android:layout_width=“wrap_content” android:layout_height=“wrap_content” android:id=“@+id/currentBrightness” android:textSize=“55px” android:layout_below=“@id/toggleButton” android:layout_centerHorizontal=“true”/> </RelativeLayout>
Now you can see what the layout looks like in the visual designer. Click the Graphical Layout tab to view the visual designer, as shown in Figure 6-8.
Depending on your layout, you ...
Get Android™ Tablet Application Development For Dummies® 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.