Android XML Embedding Multiple XML Files into 1

serbaut

New Member
I recently stumbled upon a solution that emulates the android button style through XML items. The problem is, I would have to create a different xml file for each button that my uses. (I am making a painting application with 16+ colors, so 16+ buttons) I tried to embed his XML items into a style, a drawable, and even another item so that I could keep all 16 or so buttons in one file. I keep getting "Error: Error parsing XML: unbound prefix" when I try to debug it. I am very new to the android programming scene and this is the first app that I have written in Java. (I am using the MIT app inventor software to plan my apps. Design, simple coding and the sorts). Here is my style. (Note: this is not the entire XML file, just the xml that I use for my buttons.\[code\]<style name="test"> <item android:state_pressed="true"> <shape> <gradient android:startColor="@color/yellow" android:endColor="@color/gold" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey5" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item android:state_focused="true" > <shape> <gradient android:endColor="@color/gold" android:startColor="@color/black" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey5" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item> <shape> <gradient android:endColor="@color/blue" android:startColor="@color/lime" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey5" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item></style>\[/code\]When that (minus the style tags) is put inside its own file and used as the background property of the button, it works fine, but when its 'embedded' into a style it doesn't work anymore. Is there a simple solution to put all of my buttons configurations in one file?
 
Back
Top