Hello Views

<?xml version=

"1.0" encoding="utf-8"?>

<LinearLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout width="fill parent"

android:layout height="fill parent">

<LinearLayout

android:orientation="horizontal"

android:layout width="fill parent"

android:layout height="fill parent"

android:layout weight="1">

<TextView

android

text="red"

android

gravity="center horizontal"

android

background="#aa0000"

android

layout width="wrap content"

android

layout height="fill parent"

android

layout weight="1"/>

<TextView

android

text="green"

android

gravity="center horizontal"

android

background="#0 0aa0 0"

This collection of "Hello World"-style tutorials is designed to get you quickly started with common Android Views and widgets. The aim is to let you copy and paste these kinds of boring bits so you can focus on developing the code that makes your Android application rock. Of course, we'll discuss some of the given code so that it all makes sense.

Note that a certain amount of knowledge is assumed for these tutorials. If you haven't completed the Hello, World tutorial, please do so—it will teach you many things you should know about basic Android development and Eclipse features. More specifically, you should know:

• How to create a new Android project.

• The basic structure of an Android project (resource files, layout files, etc.).

• The essential components of an Activity.

Please, also notice that, in order to make these tutorials simple, some may not convey the better Android coding practices. In particular, many of them use hard-coded strings in the layout files—the better practice is to reference strings from your strings.xml file.

0 0

Post a comment