안드로이드 버튼에 이미지 넣을 때 패딩을 어떻게 넣을까요?!
조회수 7178회
안드로이드에서 버튼을 추가하는데 이미지를 center에 두고 일정 패딩을 두고 싶습니다.
<Button
android:background="@drawble/~"
/>
요런식으로 했더니 꽉 차더라구요. ㅜㅜ
<Button
android:drawableTop="@drawable/~"
/>
요거는 위로 쓕 붙어 버리고..ㅠㅠ
center에 딱 있었으면 좋겠는데! 고수님들 알려주세요!
-
(•́ ✖ •̀)
알 수 없는 사용자
2 답변
-
부모 레이아웃이 RelativeLayout 이면
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:paddingStart="10dp" android:src="@drawable/image" android:background="@android:color/transparent" />
부모 레이아웃이 LinearLayout 이나 FrameLayout 계열이면
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:paddingStart="10dp" android:src="@drawable/download" android:background="@android:color/transparent" />
이런식으로 해보면 될 것 같아요.
-
(•́ ✖ •̀)
알 수 없는 사용자
-
-
imagebutton을 사용하고 src에 drawable 할당하시구 scaletype을 center로 설정하고 padding을 원하는데로 넣으면 될거에요~
그리고 background가 신경쓰인다면 @null로 할당하세요~
-
(•́ ✖ •̀)
알 수 없는 사용자
-
댓글 입력