Note that there are some explanatory texts on larger screens.

plurals
  1. POImageButton doesn't scale / adapt according to different resolutions
    text
    copied!<p>I have a imagebutton placed inside a RelativeLayout. However I can't seem to figure out what I need to do in order for the button to scale according to different resolutions.</p> <p>Here's the content of my activity_main.xml:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:src="@drawable/background" android:scaleType="fitCenter" android:gravity="center"/&gt; &lt;ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:background="@null" android:onClick="startVideo" android:scaleType="fitCenter" android:src="@drawable/button" android:layout_marginBottom="50dp"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>background.png is an image placed in the mdpi folder (1280x800px), button.png is also placed in the mdpi folder (757x271px). </p> <p>If I run my app on a 1280x800px resolution (galaxy tab) it looks fine, however when I try to run the app on my phone the ImageButton doesn't scale down - it keeps the original size (757x271px).</p> <p>Does anyone know a solution for this?</p>
 

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