Android Studio : ImageButton

By | 2021년 10월 15일
Table of Contents

Android Studio : ImageButton

코드

이미지 버튼은 아래 설정 정도면 될 듯 하다.

                <!-- android:scaleType="fitCenter" : parent 에 맞춰서 이미지 스캐일 -->
                <!-- android:adjustViewBounds="true" : 가로 세로 사이즈 보정 -->
                <!-- android:background="@null" : 백그라운드 투명으로 -->
                <!-- android:paddingVertical="10dp" : 이미지 내 여백 -->
                <!-- android:paddingHorizontal="10dp" : 이미지 내 여백 -->
                <ImageButton
                    android:id="@+id/imageButton"
                    android:scaleType="fitCenter"
                    android:adjustViewBounds="true"
                    android:background="@null"
                    android:paddingVertical="10dp"
                    android:paddingHorizontal="10dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:srcCompat="@drawable/map"
                    android:contentDescription="@string/map" />

결과물

답글 남기기