Reputation: 1345
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/something
tools:context=".StartupActivity">
<!--...some other view ...-->
</androidx.constraintlayout.widget.ConstraintLayout>
setting the background image with the android:background
property does set the background of the image but it scales the image to fit the screen but I'd like to centerCrop
the image to maintain its aspect ratio. How do I do that in the constraintLayout?(It has to be a constraintLayout since other views are already in place)
Upvotes: 1
Views: 284
Reputation:
Use android:adjustViewBounds="true"
in the layout it will adjust the image according to phone screen size..
Upvotes: 1