简体   繁体   English

如何在Android上运行Pinch-Zoom示例?

[英]How to run an Pinch-Zoom example on android?

To run an example on android to use PinchZoom I found the following example . 为了在android上运行一个使用PinchZoom的示例,我找到了以下示例 I was able to write a working example code which shows the View from the example - but it is all white! 我能够编写一个有效的示例代码来显示示例中的“视图”,但是全是白色的! How can I use an actual image in this example? 在此示例中,如何使用实际图像?

I tried the following in the activity-xml: 我在activity-xml中尝试了以下操作:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFF"
    android:orientation="vertical" >

    <com.example.alexander.capycoding_pinchzoom.CanvasView
        android:id="@+id/signature_canvas"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/image"
        android:textColor="#FFFFFF" />
</FrameLayout>

to use an actual non-white image, but it does not work. 使用实际的非白色图像,但是它不起作用。 (I also renamed the class from ZoomableImageView to CanvasView ). (我还将类从ZoomableImageView重命名为CanvasView )。

Maybe there is another/better example on how to make PinchZoom workable on a Canvas/Bitmap in android? 也许还有另一个/更好的示例,说明如何使PinchZoom在Android中的Canvas/Bitmap上可行?

您正在xml中使用默认图像。使用您的图像,顺便说一句,仅放置xml不能单独执行操作。我建议使用库文件进行缩放,然后为缩放规范创建一个类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM