Android Studio
메소드를 공유하는 위젯
GOD03219
2018. 1. 12. 11:22
<!--클릭 시 f1함수를 부르는 다른 버튼들이 있다면--><Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1"
android:id="@+id/button01"
android:onClick="f1"
android:background="#ffd900"
android:textColor="#00d9ff"
android:textSize="30dp"
android:enabled="true"
android:visibility="visible"
android:layout_margin="20dp"
android:padding="30dp"
/>
public void f1(View view) {
switch (view.getId()) {
case R.id.button01:
Log.v("eun", "BUTTON1");
break;
case R.id.button02:
Log.v("eun", "BUTTON2");
break;
case R.id.button03:
Log.v("eun", "BUTTON3");
break;
default:
break;
}
}