2012-04-17 60 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