0

I have an android app that loads a picture from a live webcam feed. This image is displayed within the app. The image would fill the screen nicely but for some reason - because of some Android update (App is about 4 years old and problem is old also..) the image does not resize and remains as a small box.

This is the XML code I use for the image:

     <com.test.LoaderImageView

             android:id="@+id/loaderImageView"

             android:layout_width="wrap_content"

         android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:adjustViewBounds="true"

        android:scaleType="fitCenter"

        image="http://www.tests.com/webcam.jpg"           />
Nakatomi
  • 104
  • 2
  • 13

2 Answers2

0

Try switching the scaleType to fitXY & width/height to fill_parent:

android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

This may mess up the aspect ratio. If that's a problem, but image-clipping is fine – try android:scaleType="centerCrop".

You're using a custom ImageView class, so make sure image='..' is android:src='...' – and not android:background='...'

SRC: ImageView fills parent's width OR height, but maintains aspect ratio & How to scale an Image in ImageView to keep the aspect ratio

Community
  • 1
  • 1
Evan Bashir
  • 5,501
  • 2
  • 25
  • 29
0
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dp">

<ImageView android:id="@+id/imageView"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:adjustViewBounds="true"
           android:scaleType="fitCenter"
           android:layout_marginTop="10dp"/>
</RelativeLayout>