看起来很简单,但我无法禁用一个 ImageButton
。它仍然会接收到点击事件,并且它的外观不像标准按钮那样改变。
在 SO 上有一些类似的问题,但它们对我没有帮助。
即使是这样一个非常简单的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageButton
android:id="@+id/btn_call"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:clickable="false"
android:enabled="false"
android:src="@android:drawable/sym_action_call" />
</LinearLayout>
奇怪的是,如果我将 ImageButton
更改为简单的 Button
,那么它按预期工作。按钮变为不可用且无法点击。我不明白。是否有人有想法?