我试图通过从 ImageView 转换为 TouchImageView 来美化我的图像查看器活动,这里的答案是:如何获得图像的缩放功能?
但是,当我的活动尝试加载时出现错误:
二进制 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);
有关错误的更多详细信息:
java.lang.ClassNotFoundException:加载程序dalvik.system.PathClassLoader@44bfde70中的android.view.TouchImageView