Skip to content

Instantly share code, notes, and snippets.

@springcome
Created December 20, 2016 11:28
Show Gist options
  • Save springcome/716d56bdce3e7bac3eca3c1657f9aa09 to your computer and use it in GitHub Desktop.
Save springcome/716d56bdce3e7bac3eca3c1657f9aa09 to your computer and use it in GitHub Desktop.
public class TestInput extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_input);
Button btn1 = (Button) findViewById(R.id.btn_1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "텍스트만 있는 버튼", Toast.LENGTH_SHORT).show();
}
});
ImageButton btn2 = (ImageButton) findViewById(R.id.btn_2);
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "Icon만 있는 버튼", Toast.LENGTH_SHORT).show();
}
});
Button btn3 = (Button) findViewById(R.id.btn_3);
btn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "Icon이 왼쪽에 있는 버튼", Toast.LENGTH_SHORT).show();
}
});
Button btn4 = (Button) findViewById(R.id.btn_4);
btn4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), "Icon이 오른쪽에 있는 버튼", Toast.LENGTH_SHORT).show();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment