最近の更新

2012年5月15日火曜日

(AndroidDevelopersチュートリアル)Relative Layout

【目的】
AndroidDevelopersのチュートリアルのRelative Layoutを実行します。



【手順】
1.「Androidプロジェクトの作成方法」の手順で、「AndroidSample006-HelloRelativeLayout」といプロジェクトを作成。
※プロジェクトの設定は以下の通り。

Project NameAndroidSample006-HelloRelativeLayout
ビルド・ターゲットターゲット名Android 2.1
プラットフォーム2.1
API7
Application NameAndroidSample006-HelloRelativeLayout
Package Namecom.example.androidsample006
アクティビティーの作成HelloRelativeLayout
Minimum SDK7






2.「res/layout/main.xml」を以下の様に入力。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Type here:" />

    <EditText
        android:id="@+id/entry"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/label"
        android:background="@android:drawable/editbox_background" />

    <Button
        android:id="@+id/ok"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/entry"
        android:layout_marginLeft="10dip"
        android:text="OK" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/ok"
        android:layout_toLeftOf="@id/ok"
        android:text="Cancel" />

</RelativeLayout>
3.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング。
4.「Androidプロジェクトの実行方法」の手順で、「Androidプロジェクト」を実行。
5.エミュレータが起動しロックを解除し、以下の様にアプリケーションが実行されれば成功です。










































以上です。

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。

関連記事