简体   繁体   中英

android : make imageview full screen size

I know this has been asked in stackoverflow few times ; I tried all the answers in vain. I have a custom imageview (for scroll/zoom) in my android app. I programmatically set the image to be displayed in the imageview (so, the imageview is empty in the IDE). However I try, there seems to be some padding to the left & top of the imageview which am unable to remove. Please help. This is the code (the following is one of the possible options I tried from stackoverflow) It's not possible to change the scaletype from matrix as my code for touch/zoom depends on the matrix scale type.

activity_main.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"
android:orientation="vertical"
tools:context=".ActivityHome" >

<myTouchImageView
android:id="@+id/imgView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:scaleType="matrix" />

</RelativeLayout>

However, this is what I get :

在此输入图像描述

1-将android:scaleType="matrix"更改为android:scaleType="fitXY" ,这意味着图像将被拉伸以适合父级(ImageView)的所有侧面,但是如果要保留,这将改变其分辨率分辨率使用android:scaleType="centerInside"

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