Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ImageView scale type centerCrop

I'm creating an activity on Android. I want to show a background image in it. I put a ImageView into my main RelativeLayout.

<RelativeLayout
    android:id="@+id/relativeLayoutMain"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/bgImage"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:src="@drawable/bg4"
        android:scaleType="centerCrop" />
</RelativeLayout>

It makes view like this.

enter image description here

I need to make view like this enter image description here

How can I do it?

like image 643
Erdinç Özdemir Avatar asked Jan 12 '23 20:01

Erdinç Özdemir


1 Answers

Try set ImageView attribute ScaleType=fitEnd ?

like image 147
Fedir Tsapana Avatar answered Jan 21 '23 10:01

Fedir Tsapana