나는 Andorid 퀴즈를 만들고 있는데, 클릭 할 때 버튼을 강조하고 싶지만 버튼을 놓으면 버튼이 원래 색으로 바뀝니다. 단추의 배경을 설정 했으므로 단추를 반올림 할 수 있습니다. 나는 드로어 블 (drawable)로 설정했습니다.버튼을 눌렀을 때 버튼을 강조 표시하는 방법은 무엇입니까?
<Button
android:id="@+id/btn1"
android:background="@drawable/roundedbutton"
android:textColor="#ffffff"
android:textStyle="italic"
android:layout_width="225sp"
android:layout_marginTop="23sp"
android:layout_height="38sp"
android:layout_alignLeft="@+id/btn2"
android:layout_below="@+id/textView1"
android:text="Button" />
roundedbutton.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#848482"/> <!-- this one is ths color of the Rounded Button -->
<corners
android:bottomRightRadius="6.5dp"
android:bottomLeftRadius="6.5dp"
android:topLeftRadius="6.5dp"
android:topRightRadius="6.5dp"/>
</shape>
VISHWAS의 하나와 더 완전한와 마찬가지로 컬러 필터를 사용하여 간단한 솔루션 Raghunandan의 onTouchListener 솔루션 설명 : http://stackoverflow.com/a/14278790/891479 터치시 컬러 필터를 수정하는 OnTouchListener를 만듭니다. –