티스토리 뷰

안드로이드 작업을 하다보면 이미지 버튼을 활용해야 될 때가 있습니다.


그냥 imageButton에 이미지를 넣어주면 크기가 안맞아서 정상적으로 출력되지 않을때가 종종 있습니다.



<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0sp"
android:scaleType="centerCrop"
android:id="@+id/ImageBtn"/>



그럴때는 

android:padding="0sp"
android:scaleType="centerCrop"

이 두줄을 추가 해주시면 깔끔하게 이미지가 버튼에 맞게 들어가는걸 볼 수 있습니다.


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함