我正在使用TouchImageView放大我的图片。但是,在我添加了TouchImageView.java并继续用xml创建了一个定制视图之后,它就没有出现。下面是我的xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cast_expanded_controller_background_color"
android:id="@+id/Rlay">
<com.example.zhen.myggwpapp.TouchImageView
android:layout_height="350dp"
android:id="@+id/iv_preview_image"
android:layout_width="match_parent"
android:scaleType="matrix"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" /></RelativeLayout>

发布于 2017-04-03 18:20:13
尝试在您的android:src:@drawable/some_image中添加一个ImageView,或者添加一些背景来查看它的宽度和高度。android:background="@color/some_color“
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_white"
android:id="@+id/Rlay">
<com.example.zhen.myggwpapp.TouchImageView
android:layout_height="350dp"
android:background="@color/color_black"
android:id="@+id/iv_preview_image"
android:src="@drawable/some_image"
android:layout_width="match_parent"
android:scaleType="matrix"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
</RelativeLayout>发布于 2020-08-17 07:19:55
在我的例子中,一个名为“fitImageToView”的方法有问题。在该方法中的某个地方,它需要从value:prevMatrix中获得一个浮点数组。
数组不是空的。数组中的每个集合都不是空的。但是有一些南/不是一个数字。如果您有一个NaN,那么将值设置为一个正确的数字(比如0)。在下一帧或下一次getValue中,不会出现任何NaN。
Float.isNaN(浮点f)可以帮助您检测NaN。
(在我的项目中,TouchImageView可能是非常老的版本。这个bug可能会被修复。在这种情况下..。祝好运。我什么也做不了)
https://stackoverflow.com/questions/43191598
复制相似问题