Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to correctly position android layout without using Absolute Layout?
    primarykey
    data
    text
    <p>im sorry this is a noob question but i suck at layouting. How would i make a layout that positions the flashlight_button so it would preserve the ratio between imageviews on top and bottom.</p> <p>It looks okay on nexus s (800x480), thats what i want</p> <p>...image ...</p> <p>but obviously when i switch to galaxy nexus (1280 x 720), it moves the middle button a bit to the top, like this (so it doesnt preserve the ratio between top and bottom margins as designed on nexus s)</p> <p>...image...</p> <p>The layout is here:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:padding="20dp" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginBottom="50dp" android:contentDescription="@string/application_logo_description" android:src="@drawable/mylight" /&gt; &lt;ImageButton android:id="@+id/settings_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:background="@null" android:contentDescription="@string/settings_button_description" android:src="@drawable/settings_button" /&gt; &lt;ImageButton android:id="@+id/flashlight_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageView1" android:layout_centerHorizontal="true" android:background="@null" android:contentDescription="@string/flashlight_button_description" android:src="@drawable/flashlight_button_selector" /&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/ad_button" android:layout_centerHorizontal="true" android:contentDescription="@string/powered_by_description" android:src="@drawable/powered_by" /&gt; &lt;ImageButton android:id="@+id/ad_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@null" android:contentDescription="@string/ad_button_description" android:src="@drawable/freeml" /&gt; </code></pre> <p></p> <p>so it just anchors the top and bottom imageviews to parent edges, and the middle button is just pushed down using layout_maginBottom. I am providing scaled images for different densities and obviously density pixels to express size, so as it seems it just not enough on a bigger screen. </p> <p>Whats the correct way to do this? Different .xml files or .. ?</p> <p>//Sorry i cant still post images, hope you can imagine it.</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