androidxmltouchimageviewadjustviewbounds

android ImageView adjustViewBounds not working. Whitespace


I have this problem that when I run application I get undesired white space on top of and below my image views.

I have tried to use adjustViewBounds and different scale types, the thing is I want to keep my pictures, exactly as they are, but just remove the whitespace.

The Imageviews changes to a src picture in my java code where I download the pictures to the phones activity and then set the image to the downloaded bitmap.

Here is a picture of how it looks on my emulator, there is one full screen of whitespace until you get to the next imageView, by scrolling down on the ScrollView.

enter image description here

Here you can see my XML code. TouchImageView is just a zoomable type of imageView.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fadingEdge="none"
android:fillViewport="true" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/tVInformation"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:text="TextView"
            android:visibility="gone" />

        <com.fluffow.csgosmokes.TouchImageView
            android:id="@+id/iVsmoke1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:scaleType="centerInside"
            android:src="@drawable/ic_launcher" />

        <com.fluffow.csgosmokes.TouchImageView
            android:id="@+id/iVsmoke2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:scaleType="centerInside"
            android:src="@drawable/ic_launcher" />

        <com.fluffow.csgosmokes.TouchImageView
            android:id="@+id/iVsmoke3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:scaleType="centerInside"
            android:src="@drawable/ic_launcher" />

        <com.fluffow.csgosmokes.TouchImageView
            android:id="@+id/iVsmoke4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:scaleType="centerInside"
            android:src="@drawable/ic_launcher"
            android:visibility="invisible" />
    </LinearLayout>
</RelativeLayout>

An interesting thing is the fact that each imageview got exactly one android simulator screen "whitespace" between each other, and that if I color one imageviews-background half of the whitespace will be that color, the next half is from the next imageview. It got the same amount of whitespace before and after the imageview.


Solution

  • The problem was with the touchImageView. It created a whitespace which could not be removed.