我有一个PNG格式的按钮,它处于启用状态且未被按下。当用户单击该按钮时,我只想让PNG变暗。我需要像这样的东西:
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
//normal button with background my_button.png
<item
android:state_enabled="true"
android:drawable="@drawable/my_button" //my_button.png
/>
//pressed button with background my_button.png overlayed by 50% black
<item
android:state_pressed="true"
android:state_enabled="true"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<bitmap android:src="@drawable/my_button"/>
<color android:color="#00000088"/>
</RelativeLayout>
</item>
</selector>
有没有什么方法可以做到这一点?还是我必须要有另一个PNG文件?