我正在使用带有选择器资源 xml 的相对布局来突出显示点击时的相对布局。但它不会突出显示点击时的相对布局。下面我放了相应的选择器 xml、布局 xml 和可绘制对象。
布局代码片段:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:id="@+id/rlShare"
android:background="@drawable/icon_selector"
android:clickable="true">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerInParent="true"
android:contentDescription="@string/cd_new_exam"
android:scaleType="fitXY"
android:src="@drawable/share_icon" />
</RelativeLayout>
选择器 xml 文件:
<!-- Selected -->
<item android:drawable="@drawable/icon_selected" android:state_focused="true" android:state_selected="false"/>
<!-- Pressed -->
<item android:drawable="@drawable/icon_selected" android:state_focused="false" android:state_selected="true"/>
请在这件事上给予我帮助,
先感谢您。