我遇到了一个问题,即使用与我的资源之一不同的可绘制对象绘制 ImageButton 背景。我将背景设置为透明,但在某些情况下,它会拾取我的一个名为 bottom_shadow.9.png 的可绘制对象。为什么为什么!?真是太诡异了……
我以前见过这个问题......我的一些应用用户抱怨看到这个问题,现在我决心解决这个问题!下面看看我目前拥有的。任何提示或想法都会有所帮助。
我在 values/colors.xml 下创建的颜色值:
<color name="transparent">#00000000</color>
我在 layout/ 下的一个 xml 布局下的 ImageButton:
<ImageButton
android:id="@+id/ibHelp"
android:layout_width="wrap_content"
android:layout_height="@dimen/settings_list_item_height"
android:background="@color/transparent"
android:contentDescription="@string/content_desc_more_information"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:scaleType="centerInside"
android:src="@drawable/btn_help" />
这是我在生成的 R.java 文件中看到的:
public static final class drawable {
public static final int bottom_shadow=0x7f020000;
}
public static final class color {
public static final int transparent=0x7f080009;
}
这应该是这样的:
这就是我所看到的: