我遇到了一个问题,ImageButton背景是使用与我的某个资源不同的drawable绘制的。我将背景设置为透明,但在某些情况下,它将拾取一个名为bottom_shadow.9.png的drawable。为什么为什么!?这很奇怪...ImageButton背景是自己开发的吗? Drawables wild wild?
我以前见过这个问题...我的一些应用用户抱怨看到这个问题,现在我决定解决这个问题!看看我现在有什么。任何提示或想法都会有所帮助。
我下值/ colors.xml创建的颜色值:
<color name="transparent">#00000000</color>
我在布局下一个我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;
}
这是它应该是什么样子:
这是我所看到的:
有时Eclipse中的某些内容出错,我在应用程序的错误位置看到了错误的资源。在这些情况下,清理项目对我有帮助(项目 - >清洁)。 –
感谢您的评论。我注意到,干净的帮助。这个问题有点糟糕......有时候没有办法重现它,而不是在某个电话上发生问题...... – Jona