Apply Image Click Effect

add xml format file to /res/drawable

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/image_click" />
<item android:state_focused="true" android:drawable="@drawable/image_focused" />
<item android:drawable="@drawable/image_click" />
</selector>

“@drawable/BasicImage” is default image. “@drawable/onClickImage”is focused image. BasicImage and onClickImage exist at /res/drawable/, too. add source to /res/layout/main.xml (main view layout file)

<ImageView
    android:id="@+id/id"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/image_effect"
    android:onClick="main_OnClick" />

then customizing to you.

 

댓글 남기기

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.

%d 블로거가 이것을 좋아합니다: