One attribute for several views in layout XML (Avoiding repetitive code)

eedarous

New Member
I have the following layout XML file:\[code\]<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_gravity="center"> // The layout_gravity doesn't seem to affect // the button Views // (I guess this is the wrong way to do it) <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Genre1" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Genre2" /></LinearLayout>\[/code\]How do I make a single general attribute configuration e.g. android:layout_gravity="center" for all my Button Views?
 
Back
Top