我有一个SlidingDrawer元素,其中包含一个RelativeLayout元素,该元素包含一些Button子元素:
<SlidingDrawer>
<RelativeLayout>
<LinearLayout>
<Button android:background="@drawable/foo.xml" android:duplicateParentState="false">
<Button android:background="@drawable/bar.xml" android:duplicateParentState="false">
</LinearLayout>
</RelativeLayout>
</SlidingDrawer>
foo.xml和bar.xml有选择器,根据状态应用不同的图像:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@drawable/foo_selected" />
<item android:state_pressed="true" android:drawable="@drawable/foo_selected" />
<item android:state_enabled="false" android:drawable="@drawable/foo_disabled" />
<item android:drawable="@drawable/foo_normal" />
</selector>
我遇到的问题是,当我点击滑动抽屉句柄时,按钮的按下状态也被触发了,并且它们看起来也被按下了,尽管我已经将 duplicateParentState
指定为 false。