1

Long time lurker, first time poster here!

I'm having a problem specifically on my Kindle Fire where when I insert an image (in this case a header and footer) into a relative layout and set the width to "match_parent" or "fill_parent", there is a white border around the sides.

However when I put an image into a linear layout and set the exact same parameters, it works properly.

It works perfectly on phones and my Samsung tablet, I just can't figure out what's going wrong on the Fire.

I'm hoping someone here has a fix for this problem. I can't find anything about it through google or the StackOverflow search.

Here is the XML code for my header and the relative layout.

<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"
tools:context="*****************.MainActivity"
android:background="@drawable/background_xhdpi">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/imageHeader"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/header_xhdpi"
    android:adjustViewBounds="true"/>

(Example of the problem)

Example of the problem

Thanks for your time!

1 Answers1

0

To anyone else having this problem a fellow developer gave me the solution.

Add this to your ImageViews that aren't stretching properly:

android:adjustViewBounds="true"
android:scaleType="fitXY"