2012-04-17 58 views
0

繪製我有資產文件夾背景XML說明文件,我怎麼能得到繪製 OBJ?如下 xml文件:得到資產XML文件

<?xml version="1.0" encoding="utf-8"?> 

<item android:state_focused="false"> 
    <shape> 
     <gradient android:startColor="#2b2c2d" android:endColor="#404142" android:angle="270" /> 
    </shape> 
</item> 
<item android:state_focused="true"> 
    <shape> 
     <gradient android:startColor="#2b2c2d" android:endColor="#404142" android:angle="270" /> 
    </shape> 
</item> 

回答

1

剛剛發生在繪製文件夾中的文件,你可以從那裏得到它爲R.drawwable.filename(通過代碼)和@ drawable/yourfilename(通過XML)。

通常,您不應將shape.xml文件放置在assets文件夾中。在資產的文件夾,我們一般將自定義字體,音頻文件,視頻文件等

0

在你的佈局,你可以設置爲繪製像這樣的背景:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="@drawable/drawable_name_without_the_.xml" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"/> 
+1

不能使用,因爲他有文件資產文件夾而不是可繪製文件夾。 – 2012-04-17 03:21:54