简体   繁体   中英

Expand image on layout manager of Android studio

I have picture like this, ImageView size is the same as the image size with wrap_content option .

 <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            app:srcCompat="@drawable/backnormal" />

Then I drag the edge of the imageView , only imageView is expanded and wrap_content is changed automatically like ( wrap_content -> 300dp )

I would like to expand the image itself and not only imageView . Is it possible??

You can use android:scaleType="centerCrop" attribute. There are also other values for this attribute.

Learn more here: https://developer.android.com/reference/android/widget/ImageView.ScaleType.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM