본문 바로가기

Mobile/Android

[ Android ] 버튼 이미지(변경 + hover 효과)

반응형

drawable 폴더에 xml 생성 ( reset_button_selector.xml )

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/icon_reset_on" android:state_pressed="true"></item>
    <item android:drawable="@drawable/icon_reset_off" android:state_focused="true"></item>
    <item android:drawable="@drawable/icon_reset_off" ></item>
</selector>

 

 

반응형



*** 적용 ***

<androidx.appcompat.widget.AppCompatImageView
    android:id="@+id/img_msg_list_reset"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:padding="10dp"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:src="@drawable/reset_button_selector" />
반응형