간단한 버튼으로 이미지를 추가 할 수있는 안드로이드 프로그래밍에서 이미지 버튼을 사용하고 싶습니다. 이미지 버튼의 클릭 이벤트를 어떻게 생성 할 수 있습니까?android image button
1
A
답변
1
ImageButton은 ImageView에서 상속되며 Button 속성과 비교하여 자체 속성을가집니다. 여기에 속성을 확인할 수 있습니다
, http://developer.android.com/reference/android/widget/ImageButton.html
당신의 활동이 OnClickListener를, 한 OnCreate에서 다음 를 구현하고 확인() 또는 해당 이벤트 후. 사용, 온 클릭에
ImageButton btn = new ImageButton(this); or //ImageButton btn = (ImageButton) findViewById(R.id.imgbtnid) btn.setOnClickListener(this);
()는 당신이 당신의 활동의 XML 레이아웃에 이벤트를
ImageButton imgbtn=new ImageButton(this);
imgbtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
1
이를 처리 할 수있는 기능. ... 특정 ImageButton에 대한 속성 ...
android : onClick = "- 여기에 .java에있는 메소드 이름을 쓰십시오."
해피 코딩!
2
이동을 클릭하고이를 추가 취득이 유형으로 클릭 이벤트
관련 문제
- 1. android webview forward button
- 2. android custrom control (button)
- 3. android : button 내부의 이미지보기
- 4. android listview button control
- 5. Android MenuItem Toggle Button
- 6. Android webview back button
- 7. android Listview Image Loading
- 8. android rotating image
- 9. android image gradient
- 10. android image transparency
- 11. android button fine text alignment
- 12. android honeycomb menu button target
- 13. <button> 대 <input type = "image">
- 14. webview image 클릭하면 확대됩니다 android
- 15. android image fadein 또는 fadeout
- 16. android image res/drawable 폴더에 저장
- 17. Android : Button RelativeLayout의 위치 지정 문제
- 18. android separate button press press on
- 19. Button 클래스에 getOnClickListener가없는 이유는 무엇입니까? (Android)
- 20. RadioButton Image
- 21. android : webservice image 로컬 폴더의 이미지로 바꾸기
- 22. android java 문자열에서 html image 태그를 가져옵니다.
- 23. UIImagePickerController button
- 24. NSButton + & - Button
- 25. SlideShowPro button
- 26. image/pjpeg 및 image/jpeg
- 27. ScaleTransform for Image
- 28. image form submit IE
- 29. Android Button ==> 강조 표시된 이미지를 설정 하시겠습니까?
- 30. Button In FrameLayout ==> y를 변경 하시겠습니까? Android