我正在为 ImageView 创建选择器,没关系。但是当我将背景图像设置为 ImageView 时,选择器不再起作用。
我的 ImageView(无背景图像)是
<ImageView
android:id="@+id/dashboard"
style="@style/glow_effect_style"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip" />
和选择器glow_effect_style.xml
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/glow_effect" android:state_pressed="true"/>
</selector>
和风格
<style name="glow_effect_style">
<item name="android:background">@drawable/glow_effect_selector</item>
</style>
那么,它是否与 ImageView 中的“android:background”和“style”属性相关?我在这里丢了...