Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't support multiple screen resolution
    primarykey
    data
    text
    <p>I'm struggling to finish my Android app, but I'm having some problems with the UI. My problem is very basic, I've developed the UI using the default AVD when using AVD manager in Eclipse (HVGA, with a density of 160 dpi), and when I execute the app I see it as I designed, but if I change the target device (i.e. WVGA or QVGA) all the components in the layout are in a different position than the original. As far as I saw in the recommendations for support multiple screens, I should not use AbsoluteLayouts, in fact I'm using RelativeLayouts, I'm not using "px" for the dimensions (or positions), just "wrap_content" or "fill_parent", and in case I need an specific position I'm using "dp" (tested too with "sp"), also I've scaled the images for ldpi (0.75x), and still have the issue (not a particular screen, the hole app) ...so, my question is, is there any other UI tip that I'm missing?.<br/> I'm putting a sample code and the results that I observe when testing it with a HVGA AVD (bigger image) and with a QVGA AVD. As you can see, the position of the yellow/green squares is different, as well as the size of the last row of images.<br/> PS: I'm using a TabLayout also, so the background is loaded through code (tabHost.setBackgroundDrawable(getResources().getDrawable(R.drawable.background1))) <br/>Any help will be appreciated.</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/row1" android:layout_centerHorizontal="true" android:layout_marginTop="140dp" &gt; &lt;ImageView android:id="@+id/btn1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:clickable="true" android:onClick="method1" android:src="@drawable/button1" /&gt; &lt;ImageView android:id="@+id/btn2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:clickable="true" android:onClick="method1" android:src="@drawable/button2" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_below="@id/row1" android:layout_centerHorizontal="true" &gt; &lt;ImageView android:id="@+id/btn3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:clickable="true" android:onClick="method1" android:src="@drawable/button3" /&gt; &lt;ImageView android:id="@+id/btn4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:clickable="true" android:onClick="method1" android:src="@drawable/button4" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p><img src="https://i.stack.imgur.com/MraYO.png" alt="screen at 240x320"> <img src="https://i.stack.imgur.com/eKttw.png" alt="screen at 320x480"></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.
 

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