Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fit text inside button when using layout_weight?
    text
    copied!<p>I am using a linear layout, with orientation =vertical, I have 3 buttons inside this linear layout with different weights(so that 3 of them fill the page horizontally). Because I want the button to look shorter, I set the height to 42 dip. It is looking fine in a big screen device, but when I test it on a very small screen device, half of the words in the middle button disappear because of the sizing issue. How do I solve this?</p> <pre><code>&lt;LinearLayout android:id="@+id/StatisticsButtons" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="10dip" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/viewAllBtn" android:layout_width="0dp" android:layout_height="42dip" android:layout_weight="1" android:background="@drawable/button_for_statistic" android:text="View All" android:textColor="@drawable/button_text_color_statistic" android:textSize="17dip" /&gt; &lt;Button android:id="@+id/viewPartialBtn" android:layout_width="0dp" android:layout_height="42dip" android:layout_marginLeft="10dip" android:layout_weight="1.3" android:background="@drawable/button_for_statistic" android:text="View partial record" //"View partial" displayed , I guess the screen is too "narrow" to display the "record" android:textColor="@drawable/button_text_color_statistic" android:textSize="17dip" /&gt; &lt;Button android:id="@+id/viewLeaveBtn" android:layout_width="0dp" android:layout_height="42dip" android:layout_marginLeft="10dip" android:layout_weight="1" android:background="@drawable/button_for_statistic" android:text="Leave" android:textColor="@drawable/button_text_color_statistic" android:textSize="17dip" /&gt; &lt;/LinearLayout&gt; </code></pre> <p> </p> <pre><code>&lt;item android:state_pressed="true"&gt;&lt;shape&gt; &lt;solid android:color="#0033d434" /&gt; &lt;stroke android:width="2dp" android:color="#aaa22f" /&gt; &lt;corners android:radius="2dp" /&gt; &lt;padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /&gt; &lt;/shape&gt;&lt;/item&gt; &lt;item&gt;&lt;shape&gt; &lt;solid android:color="#aaa22f" /&gt; &lt;corners android:radius="2dp" /&gt; &lt;padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" /&gt; &lt;/shape&gt;&lt;/item&gt; </code></pre> <p></p>
 

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