0

I have a background xml desc file in assets folder, how can i get the drawable obj? xml file as below:

<?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>

4

2 に答える 2

1

Just place the file in drawable folder and you can get it from there as R.drawwable.filename(through code) and @drawable/yourfilename(through XML).

Generally, You should not place shape.xml files in assets folder. In assets folder we generally place custom fonts, audio file,video file etc.

于 2012-04-17T03:10:33.140 に答える
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"/>
于 2012-04-17T03:14:24.040 に答える