tags:

views:

71

answers:

1

I have a Button that I am using 13 times in my Android application's main.xml file. I would like to have the XML for it defined once, so that I can make changes in one place instead of 13. Each of the 13 instances needs to have its own ID, though. What should I do to simplify my XML? I've tried using <include> but it hasn't worked for me. I must have been doing something wrong. I'd appreciate it if anyone could show me how to do it correctly. Thanks.

Here's the XML for the button that I'd like to reuse:

<Button
  android:width="70dp" 
  android:layout_marginLeft="10dp"
  android:layout_marginRight="10dp" />
+6  A: 

You should use Styles and Themes for that sort of things.

Macarse
Perfect. That worked. Thanks.
Daedylus