Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Handling images size for multiple screens
    primarykey
    data
    text
    <p>I find it really hard to handle images with Android, I think it's the hardest part of Android development...</p> <p>1) I have an image, I want it to be the background of my application so I do</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity" android:background="@drawable/accueil"&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The background should fill the entire screen but it's not the cas. Only a part of the background is shown on some (small) screens. How could I say: I want the image to fill all the screen even if the image is bigger then the screen the image should be reduced so I see all the background?</p> <p>Maybe I should put my background instead of using it as a background</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context=".MainActivity"&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="500dp" android:layout_height="500dp" android:adjustViewBounds="false" android:src="@drawable/accueil" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Yet in some devices the image is a bit cropped.</p> <p>2) I have to place a layout in another layout but I want its position to be precise, its width to be relative to the parent layout. Yet if I do</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/fond"&gt; &lt;LinearLayout android:layout_width="300dp" android:layout_height="350dp" android:layout_marginTop="20dp" android:background="@drawable/fondshare" android:orientation="vertical" &gt; </code></pre> <p>you can see the result is not what I expected (the linear layout being the rectangle with the smiley and all the buttons) <img src="https://i.stack.imgur.com/FX4SK.jpg" alt="enter image description here"></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