티스토리 뷰

activity_main.xml


    <Button
        android:id="@+id/btn1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/strbtn1"
         
        />

MainActivity.java

//...
	Button btn1;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		btn1 = (Button)findViewById(R.id.btn1);
		btn1.setText("안드로이드 버튼 레벨");
		btn1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Toast.makeText(MainActivity.this, "버튼 클릭했음", Toast.LENGTH_LONG).show();
			}
		});
		
		
	}
//...

 

res/values/string.xml



    Test01
    Settings

    사용자버튼

 

 

실행화면