티스토리 뷰

Android/UI

ImageButton

parkho79 2019. 8. 5. 10:34
728x90



 

ImageButton 은 일반 Button 에 custom image 를 보여주기 위해 사용한다.

Image 는 xml 의 "src" 속성이나 code 상의 "setImageResource()" method 를 사용해 설정할 수 있다.



How to

◼ ImageButton code in XML

 

◼ ImageButton code in JAVA



Attributes

◼ id

id 는 해당 ImageButton 을 유일하게 식별할 수 있는 속성이다.



◼ src

ImageButton 에 표시할 image 를 설정한다.

 



◼ background

ImageButton 의 배경색을 설정한다.

- color 값이나 drawable 을 설정할 수 있다.

 



◼ padding

ImageButton 의 왼쪽, 오른쪽, 위, 아래 padding 을 설정한다.

 



728x90

'Android > UI' 카테고리의 다른 글

ImageView scaleType  (0) 2019.08.07
ImageView  (0) 2019.08.06
Button  (0) 2019.07.26
RadioButton & RadioGroup  (0) 2019.07.22
CheckBox  (0) 2019.07.18
댓글