2013-02-19 57 views
0

我正在嘗試爲我的應用程序製作主題更改選項。 我在這裏讀到類似我的一些類似的問題,但解決方案無法正常工作。設置樣式圖像以便在xml中使用

要我styles.xml我說:

<style name="themeBackground"> 
     <item name="android:src">@drawable/background2</item> 
    </style> 

在我加入layot的XML:

android:background="@style/themeBackground" 

錯誤我得到:

Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f060000 a=-1 r=0x7f060000} 

我試着刪除 - android:theme="@style/AppTheme"從這裏在其他一些地方建議的清單來看,它不起作用。有任何想法嗎 ?

謝謝!

回答

0

在res /價值/目錄創建一個文件attrs.xml並添加代碼:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
<attr name="themeBackground" format="reference" /> 
</resources> 
相關問題