package jp.javadrive.android; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.view.ViewGroup; import android.widget.LinearLayout; public class Test03_01 extends Activity { private final int FP = ViewGroup.LayoutParams.FILL_PARENT; private final int WC = ViewGroup.LayoutParams.WRAP_CONTENT; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); setContentView(linearLayout); CharSequence strHello = getString(R.string.hello_msg); CharSequence strHelloJp = getString(R.string.hello_msg_jp); TextView text1 = new TextView(this); text1.setText(strHello); linearLayout.addView(text1, createParam(WC, WC)); TextView text2 = new TextView(this); text2.setText(strHelloJp); linearLayout.addView(text2, createParam(WC, WC)); } private LinearLayout.LayoutParams createParam(int w, int h){ return new LinearLayout.LayoutParams(w, h); } }