我正试图通过将ImageView转换为TouchImageView来增加图像查看器的活动,根据这里的答案:How can I get zoom functionality for images?
但是,当我的活动试图加载时,我会收到一个错误:
二进制XML文件行#15:错误充气类TouchImageView
这是我的image_viewer.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--
<WebView
android:id="@+id/webView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-->
<TouchImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>以及我在ImageViewer.java的onCreate中的代码(尽管我非常肯定执行永远不会达到这个程度):
if(filepath != null && filepath.length() > 0 && new File(filepath).exists())
{
Bitmap myBitmap = BitmapFactory.decodeFile(filepath);
TouchImageView imgView = (TouchImageView) findViewById(R.id.imageView1);
imgView.setImageBitmap(myBitmap);
}对于造成这一错误的原因或原因有什么想法吗?我看到的是最内在的例外/原因。不知道如何才能获得关于错误的更多细节。
提前谢谢。
更新:
在执行此行时引发异常:
setContentView(R.layout.image_viewer);关于该错误的进一步详细信息:
加载器dalvik.system.PathClassLoader@44bfde70中的
java.lang.ClassNotFoundException: android.view.TouchImageView
发布于 2011-07-27 15:49:12
您需要有任何自定义视图类的完全限定名。例如:
<com.kon.thing.TouchImageView ... />JVM找不到您的类。
发布于 2013-11-13 10:24:42
确保您在xml中输入了正确的包名,如..。
<com.gallery.TouchImageView
android:id="@+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter" />https://stackoverflow.com/questions/6847265
复制相似问题