******************** ListMain.java ********************
package jp.lesson.study10;
import android.app.ListActivity;
import android.os.Bundle;
public class ListMain extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);
setContentView(R.layout.listmain);
}
}
******************** listmain.xml ********************
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/android:list"android:entries="@array/sampledata"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
<LinearLayout
android:id="@+id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:text="empty list"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
******************** arrays.xml ********************
<?xml version="1.0" encoding="utf-8"?><resources>
<string-array name="sampledata">
<item >data1</item>
<item >data2</item>
<item >data3</item>
<item >data4</item>
<item >data5</item>
</string-array>
</resources>
******************** strings.xml ********************
<resources><string name="app_name">Study10</string>
<string name="hello_world">hello</string>
<string name="menu_settings">menu</string>
<string name="title_activity_main">MainActivity</string>
<string name="title_memo">MemoActivity</string>
<string name="lbSave">保存</string>
<string name="lbCancel">キャンセル</string>
<string name="lbSaveTitle">保存確認</string>
<string name="lbYes">はい</string>
<string name="lbNo">いいえ</string>
</resources>
******************** AndroidManifest.xml ********************
<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="jp.lesson.study10"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="4"android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MemoActivity"
android:label="@string/title_memo">
<!--
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
-->
</activity>
<activity
android:name=".ListMain"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
0 件のコメント:
コメントを投稿