package jp.javadrive.android; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.widget.LinearLayout; import android.view.ViewGroup; import android.graphics.Color; public class Test03_01 extends Activity { private final int WRAP_CONTENT = ViewGroup.LayoutParams.WRAP_CONTENT; /** Called with the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); setContentView(linearLayout); TextView tv1 = new TextView(this); tv1.setText("Color [255, 0, 0]"); tv1.setTextColor(Color.rgb(255, 0, 0)); linearLayout.addView(tv1, new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); TextView tv2 = new TextView(this); tv2.setText("Color [127, 127, 0]"); tv2.setTextColor(Color.rgb(127, 127, 0)); linearLayout.addView(tv2, new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); TextView tv3 = new TextView(this); tv3.setText("Color [139, 69, 1]"); tv3.setTextColor(Color.rgb(139, 69, 1)); linearLayout.addView(tv3, new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); } }