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