Android/helloworld
提供: 初心者エンジニアの簡易メモ
プログラム(src/com/example/AndroindHelloworld/AndroindHelloworld.java
package com.example.AndroidHelloworld;
import android.app.Activity;
import android.os.Bundle;
public class AndroidHelloworld extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
メインレイアウト(res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:id="@+id/textView1" android:text="@string/hello" android:layout_height="wrap_content"></TextView> </LinearLayout>
データパーツ(res/values/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, AndroidHelloworld!</string>
<string name="app_name">AndroidHelloworld</string>
</resources>
