Android set XML shape as drawable programmatically

nshop1

New Member
Hello I have a drawable myshape.xml, it contains a \[code\]<shape>\[/code\] and I cannot set an android:id to shapes.In my code I want to set the background of a view to this file using\[code\]catAll.setBackgroundDrawable(getResources().getDrawable(R.id......???));\[/code\]where myshape.xml does not show up in my R file because it has no id. and I cannot set id to object.In my XML I do set the shape by simply typing the drawable resource name. But I need to do this programmatically.
 
Back
Top