change imageview to fit the complete screen width
android:scaleType="fitXY"
or
android:scaleType="centerCrop"
Domanda
I want to display an image on top of my activity that always fill the screens width. If I set its width to match parent and its height to wrap content there is a white stripe at the sides of the image on larger screen. How can I make that this image always fill the screen horizontally?
My xml:
<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" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/hello_world"
android:src="@drawable/tbbt" />
</RelativeLayout>
Thanks in advance.
Soluzione
change imageview to fit the complete screen width
android:scaleType="fitXY"
or
android:scaleType="centerCrop"