Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I scale down multiple layouts automatically in case there is no space left?
    primarykey
    data
    text
    <p>I want to create a view that shows 8 items the user can hold. When there are less than 8 items available, the imageView of the item will be replaced by a default image.</p> <p>The user is able to klick the item and he will see a description of each item in a texbox on the top of the layout. This EditText is placed on top of an image, the "textbox". So far i noticed there is an option to attent an image to the editText, so this problem may be solved.</p> <p>On the bottom of the layout I want a cancel button on the left side, and an accept button on the right side. This way the user may go back to the game without choosing an item or select an item to use it.</p> <p>The Problem is, when there is no space left to draw the images at full resolution, the layouts try to draw their content in full resolution. This is why my upper row of items is drawn in full size while the second row is scaled down.</p> <p>This is how it should look like:</p> <p><img src="https://i.stack.imgur.com/AsE8C.png" alt="enter image description here"></p> <p>I then tried the following:</p> <ul> <li>The root layout is a linear layout</li> <li>The first layout is a relative layout, holding the imageview and the EditText.</li> <li>These are followed by a Linear layout (vertical), parenting two other linear layouts (horizontal).</li> <li>I put 4 imageViews in each of them, representing the items.</li> </ul> <p><img src="https://i.stack.imgur.com/YKjV4.png" alt="enter image description here"> So far I didn't think about the accept- and cancel buttons, because my result is a total mess yet. <img src="https://i.stack.imgur.com/g4hfs.png" alt="enter image description here"></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:gravity="bottom" android:orientation="vertical" &gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/textboxview" android:layout_width="fill_parent" android:layout_height="70dp" android:scaleType="fitXY" android:src="@drawable/textbox" /&gt; &lt;com.gootsProject.AutoResizeTextView android:id="@+id/dialogText" style="@style/monologText" android:layout_width="fill_parent" android:layout_height="50dp" /&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/ImageView07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/ImageView05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/ImageView04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/ImageView06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/ImageView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2dp" android:src="@drawable/item_noitem" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Can you help me to setup this view as I intended? I'm lost.</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.
    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