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

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.

Figure 6-8: The visual designer view of the layout.

image

image Depending on your layout, you ...

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