Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid :: How To Change Fontsize Without Changing Button Size?
    text
    copied!<p>I have an XML grid table layout menu of equally sized buttons the buttons change their size depending on the phone resolution. The idea is to make the menu fill the screen with equally sized buttons. This works perfect when the buttons don't have a text label. But as soon as i add text on the button then the width of the button is also affected by the text. If i change the text size to a smaller size, then the button automatically re-sizes to be smaller than the others. For example: Name for Button A is "Home" Name for Button B is "Notifications" My problem is that Button B becomes bigger than Button A, i want all button to have the same width no mater what the label text size is. I will also attach the XML layout.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="4dp" android:background="#2b2c31" android:orientation="vertical" &gt; &lt;include android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/layout_topheader" /&gt; &lt;TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:stretchColumns="*" &gt; &lt;TableRow android:layout_weight="1" android:gravity="center" android:padding="10dp" &gt; &lt;Button android:id="@+id/buttonScan" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/btn" android:text="Refill" android:layout_margin="10dp" android:textColor="@color/status_text" android:textSize="30dip" android:textStyle="bold" /&gt; &lt;Button android:id="@+id/buttonSetReminder" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/btn" android:text="Reminders" android:layout_margin="10dp" android:textColor="@color/status_text" android:textSize="30dip" android:textStyle="bold" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_weight="1" android:gravity="center" android:padding="10dp" &gt; &lt;Button android:id="@+id/buttonRewards" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/btn" android:layout_margin="10dp" android:textSize="30dip" android:textColorHint="@color/status_text" android:textColor="@color/status_text" android:text="Rewards" android:textStyle="bold" /&gt; &lt;Button android:id="@+id/buttonTracker" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/btn" android:text=" Tracker" android:layout_margin="10dp" android:textColor="@color/status_text" android:textSize="30dip" android:textStyle="bold" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_weight="1" android:gravity="center" android:padding="10dp" &gt; &lt;Button android:id="@+id/buttonProfile" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/btn" android:text="Profile" android:layout_margin="10dp" android:textColor="@color/status_text" android:textSize="30dip" android:textStyle="bold" /&gt; &lt;Button android:id="@+id/buttonChat" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/chaticon" android:text="Chat" android:layout_margin="10dp" android:textColor="@color/status_text" android:textSize="30dip" android:textStyle="bold" /&gt; &lt;/TableRow&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/add3" /&gt; &lt;/LinearLayout&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload