Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't need to specify all these different sizes to achieve a screen as simple as that one. Simply play a bit around with layouts. For example let's take your first screen. You could use a TableLayout or even a vertical LinearLayout with N LinearLayout inside. At this point simply use weights! Example: want a grid of two rows and three square images for each row:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p></p> <pre><code>&lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;ImageView android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight=".33" /&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>Now unfortunately that's still not enough for you. Another thing you might want to accomplish is to still have your images have a square ratio. To achieve that simply extend image view like this:</p> <pre><code>public class SquaredImageView extends ImageView { public SquaredImageView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ int width = MeasureSpec.getSize(widthMeasureSpec); int height = width; setMeasuredDimension(width, height); } </code></pre> <p>}</p> <p>Now simply provide images in the right densities and everything will look exactly as you want</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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