我遇到了一個問題,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