为了在安卓上运行一个使用PinchZoom的例子,我找到了下面的example。我能够写一个正常工作的示例代码来显示示例中的视图--但它是白色的!如何在本例中使用实际的图像?
我在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>使用实际的非白色图像,但它不起作用。(我还将这个类从ZoomableImageView重命名为CanvasView)。
也许有另一个/更好的例子可以让PinchZoom在安卓的Canvas/Bitmap上工作?
发布于 2016-12-16 18:46:07
您正在使用xml.use中的默认图像您的图像,顺便说一下,仅仅使用xml不能单独执行该操作。我建议使用库文件进行收缩缩放,然后为缩放规范创建一个类
https://stackoverflow.com/questions/41180581
复制相似问题