小编iis*_*rfl的帖子

如何实现android zoomview?

我想实现android-zoom-view(https://code.google.com/p/android-zoom-view/).我将jar添加到buildpath中.我创建了以下xml:

<?xml version="1.0" encoding="utf-8"?>
<pl.polidea.view.ZoomView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

     <ImageView
        android:id="@+id/webcam1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_marginBottom="20dp"
        android:scaleType="matrix" />

    <ImageView
        android:id="@+id/webcam2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:scaleType="matrix" />
</pl.polidea.view.ZoomView>
Run Code Online (Sandbox Code Playgroud)

并将以下代码添加到我的活动中:

    View v = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.zoomable_view, null, false);
    v.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    zoomView = new ZoomView(this);
    zoomView.addView(v);

    LinearLayout main_container = (LinearLayout) findViewById(R.id.LinearLayout1);
    main_container.addView(zoomView);
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?我收到以下错误:

Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class pl.polidea.view.ZoomView
Run Code Online (Sandbox Code Playgroud)

android zooming

1
推荐指数
1
解决办法
2931
查看次数

标签 统计

android ×1

zooming ×1