Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid how to make buttons fit on various screen sizes
    primarykey
    data
    text
    <p>I've an app that has a menu of about 10 buttons. On my test phone(HTC ONE X), all of the buttons are displayed correctly. On my other test phone(HTC Desire C) a couple of buttons are off the screen. The bottom 2 buttons and textviews are missing.</p> <p>How can I make the whole layout fit various screen sizes? Do i have to get the screen size at run-time eg use getDisplayMetrics etc?</p> <p>Thanks in advance, Matt.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/carefreebgscaledlighting" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;TextView android:id="@+id/textviewcompanyname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#003F87" /&gt; &lt;TextView android:id="@+id/spacerasnexttextviewclasheswithbg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringloggedinscreen" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#003F87" /&gt; &lt;Button android:id="@+id/buttonsignin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringbuttonsignin" /&gt; &lt;Button android:id="@+id/buttongetrota" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringbuttongetrota" /&gt; &lt;Button android:id="@+id/buttongetphonenumbers" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringbuttongetphonenumbers" /&gt; &lt;Button android:id="@+id/viewtransactionsactual" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="View Transactions" /&gt; &lt;Button android:id="@+id/buttondeletecarertable" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringbuttondeletetable" /&gt; &lt;Button android:id="@+id/buttonloadtransactionsmap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringloadtransactionmap" /&gt; &lt;Button android:id="@+id/buttonloneworker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/buttonloneworker" /&gt; &lt;Button android:id="@+id/buttonsendOutstandingTransactions" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringSendOutstandingTransactions" /&gt; &lt;Button android:id="@+id/buttoncreatemanuallogout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="@string/stringbuttoncreatemanuallogout" /&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/textViewYouAreSignedIn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_alignParentTop="true" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#FFFFFF" /&gt; &lt;TextView android:id="@+id/textViewUnsentTransactions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_below="@id/textViewYouAreSignedIn" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#FFFFFF" /&gt; &lt;TextView android:id="@+id/textViewVersionmenuscreen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/stringtextviewversion" android:layout_alignParentBottom="true"/&gt; &lt;/RelativeLayout&gt; &lt;/LinearLay </code></pre> <p>out></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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