December 2011
Beginner
384 pages
9h 48m
English
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.
Figure 6-8: The visual designer view of the layout.

Depending on your layout, you ...
Read now
Unlock full access