package soo.base; import android.app.Activity; import android.os.Bundle; import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; public class Hello2T extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); LinearLayout ll = new LinearLayout(this); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0f ); ll.setLayoutParams(params); ll.setOrientation(LinearLayout.VERTICAL); //TextView TextView tv = new TextView(this); tv.setText(R.string.hello); LinearLayout.LayoutParams tvParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0.0f ); tv.setLayoutParams(tvParams); ll.addView(tv); //Button 1 Button btn = new Button(this); btn.setText("버튼1"); LinearLayout.LayoutParams btnParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0f ); btn.setLayoutParams(btnParams); ll.addView(btn); //Button 2 Button btn2 = new Button(this); btn2.setText("버튼2"); ll.addView(btn2); setContentView(ll); } }