Note that there are some explanatory texts on larger screens.

plurals
  1. POScale layout items equally on large screens
    primarykey
    data
    text
    <p>I've got a 4-item start screen in my app, which looks like the following: <img src="https://i.stack.imgur.com/61scp.png" alt="enter image description here"></p> <p>What's important to me there: - All items do have the same width (not regarding how much text is actually in it) - Look the same on all devices (small-screen, mdpi, large-screen, etc.)</p> <p>Im just wondering if there is a easy solution about this problem?</p> <p>I've tried using 3 LinearLayouts but thats really awkward.. (1 presenting the layout root[vertical] and two which do each contain 2 buttons[horizonal]). Making this layout ready for multiple screens would require a lot of fixed-width and fixed-margin hacking. Just like "button margin = 30dp on xlarge, 20 on large, 15 on normal,...".</p> <p>My layout-xml:</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="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:id="@+id/main_root" android:orientation="vertical" android:gravity="center" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center" &gt; &lt;Button android:id="@+id/btn_learn" android:text="@string/mainBtn_learn" style="@style/mainBtn" android:onClick="handleBtnClick" android:layout_margin="20dip" /&gt; &lt;Button android:id="@+id/btn_quiz" android:text="@string/mainBtn_quiz" style="@style/mainBtn" android:onClick="handleBtnClick" android:layout_margin="20dip" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="center" &gt; &lt;Button android:id="@+id/btn_search" android:text="@string/mainBtn_search" style="@style/mainBtn" android:onClick="handleBtnClick" android:layout_margin="20dip" /&gt; &lt;Button android:id="@+id/btn_more" android:text="@string/mainBtn_more" style="@style/mainBtn" android:onClick="handleBtnClick" android:layout_margin="20dip" /&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>Is there a view which "auto-scales" these Buttons or still any other easier solution?</p> <h1>Edit:</h1> <p>So, in special, you need something like button:</p> <pre><code> android:layout_width="15%" // 15% of screen width / height depending on the orientation android:layout_marginBottom="10%" // see above </code></pre>
    singulars
    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.
    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