<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<gradient
android:endColor="@color/orange_light"
android:startColor="@color/orange"
android:angle="270" />
<corners
android:radius="6dp" />
<padding
android:left="10dp"
android:right="10dp" />
</shape>
</item>
<item android:state_focused="true" >
<shape>
<gradient
android:endColor="@color/orange_light"
android:startColor="@color/orange"
android:angle="270" />
<corners
android:radius="6dp" />
<padding
android:left="10dp"
android:right="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:endColor="@color/grey_light"
android:startColor="@color/grey"
android:angle="270" />
<corners
android:radius="6dp" />
<padding
android:left="10dp"
android:right="10dp" />
</shape>
</item>
</selector>
내 버튼의 상태를 정의하고 내 버튼의 배경으로 설정하십시오.
내가 그것을 누르면 색이 바뀌지 만 일단 눌렀다 떼면 '눌렀다'색을 유지하고 싶습니다 (어떤 단추가 활성 상태인지 보여주기 위해).
어떻게하면됩니까? requestFocus()
당신이 필요 ...
감사
왜 당신이 체크 박스 생각처럼 할 수있는 터치 리스너에 오버라이드 (override)보다 프레스 상태에? ToggleButton 일 수도 있지만 CheckBox는 거의 없습니다. – CoolMind