How can I give all elements fixed width inside LinearLayout
?Imagine I have a list of buttons and I would to center them all and also give them same width based on the element with the biggest width, is there any way how to make the layout manager to do this dynamically (I mean don't repeat the code for every button)?My code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Button android:id="@+id/mainStageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="menuClickListener"
android:text="@string/mainStage"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="menuClickListener"
android:text="@string/amphiteatre"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="menuClickListener"
android:text="@string/aula" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="menuClickListener"
android:text="@string/mensa"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="menuClickListener"
android:text="@string/sportsSchedule"/>