I know this should be simple , but android:scaleType="centerCrop"
doesn't crop Image
I got image 1950 pixels wide and need it to be cropped by parent's width. But android:scaleType="centerCrop"
dosen't crop Image. What do I need to do in layout to show only first 400 pixels, for instance or whatever screen/parent width is
Sorry for simple question - tried to google it - only complicated questions there. And I'm new, so dont downvote plz)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rl1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color">
<ImageView
android:id="@+id/ver_bottompanelprayer"
android:layout_width="match_parent"
android:layout_height="227px"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scaleType="matrix"
android:background="@drawable/ver_bottom_panel_tiled_long" />
</RelativeLayout>
Try adding android:adjustViewBounds="true"
to your ImageView
together with android:scaleType
property
Use android:scaleType="matrix"
for your imageview
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/opLayout"
android:layout_width="400px"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix"
android:src="@drawable/ic_launcher_web" />
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With