首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有以xml显示的TouchImageView

没有以xml显示的TouchImageView
EN

Stack Overflow用户
提问于 2017-04-03 18:15:32
回答 2查看 406关注 0票数 0

我正在使用TouchImageView放大我的图片。但是,在我添加了TouchImageView.java并继续用xml创建了一个定制视图之后,它就没有出现。下面是我的xml文件:

代码语言:javascript
复制
<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>

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-04-03 18:20:13

尝试在您的android:src:@drawable/some_image中添加一个ImageView,或者添加一些背景来查看它的宽度和高度。android:background="@color/some_color

代码语言:javascript
复制
  <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>
票数 1
EN

Stack Overflow用户

发布于 2020-08-17 07:19:55

在我的例子中,一个名为“fitImageToView”的方法有问题。在该方法中的某个地方,它需要从value:prevMatrix中获得一个浮点数组。

数组不是空的。数组中的每个集合都不是空的。但是有一些南/不是一个数字。如果您有一个NaN,那么将值设置为一个正确的数字(比如0)。在下一帧或下一次getValue中,不会出现任何NaN。

Float.isNaN(浮点f)可以帮助您检测NaN。

(在我的项目中,TouchImageView可能是非常老的版本。这个bug可能会被修复。在这种情况下..。祝好运。我什么也做不了)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43191598

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档