Android Tutorial

(avery) #1
Android Tutorial 155

android:text=”@string/test_string”
android:textColor=”@color/text_color”
android:gravity=”center”
android:textSize=”@dimen/text_size”>



main.xml layout file displays in the emulator.

The preceding layout describes all the
visual elements on a screen. In this
example, a LinearLayout control is used as
a container for other user interface
controls—here, a single TextView that
displays a line of text.

Designing Layouts in Eclipse

Layouts can be designed and previewed in
Eclipse using the Resource editor
functionality provided by the Android plug-
in. If you click the project file /res /layout
/main.xml (provided with any new Android
project), you see a Layout tab, which
shows you the preview of the layout, and a main.xml tab, which
shows you the raw XML of the layout file.
Free download pdf