2012-09-15 7 views
0

투명한 배경과 이미지가 포 그라운드로있는 이미지 버튼이 있습니다. 내가하고 싶은 것은 버튼을 누르면 버튼이 반짝 거립니다. 이제 위아래 상태에 대해 서로 다른 두 개의 이미지를 정의하고 싶지는 않습니다. 버튼의 배경과 전경과 배경에 대한 선택기 색상을 정의 할 수있는 이유가 있습니까? 당신은 버튼의 DIFF-2 상태의 버튼의 배경 선택을위한이 코드를 사용할 수 있습니다클릭하면 Android ImageButton 배경이 변경됩니다.

+0

눌렀을 때 이미지 버튼에 다른 색상을 표시 하시겠습니까? –

답변

1

친절 감사는,이 당김 폴더에있는 파일 및 설정 버튼 배경을 저장합니다. 희망이 당신에게 유용 할 것입니다 ... :)

<?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/button_pressed" /> <!-- pressed --> 
<item android:state_focused="true" 
     android:drawable="@drawable/button_focused" /> <!-- focused --> 
<item android:drawable="@drawable/button_normal" /> <!-- default --> 
</selector> 
관련 문제