2016-12-16 5 views
0

PinchZoom을 사용하기 위해 안드로이드에서 예제를 실행하려면 다음을 찾았습니다. example. 예제에서보기를 보여주는 작업 예제 코드를 작성할 수 있었지만 모두 흰색이었습니다! 이 예제에서 실제 이미지를 사용하려면 어떻게해야합니까? android에서 Pinch-Zoom 예제를 실행하는 방법은 무엇입니까?

은 내가 활동-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을 작동시키는 방법에 대한 또 다른/좋은 예가 있습니까?

+0

실제로 작동하는 쉬운 예 : http://stackoverflow.com/questions/5216658/pinch-zoom-for-custom-view – Alex

답변

0

xml.use에서 이미지를 기본 이미지로 사용하고 xml을 삽입하는 것만으로는 action.i을 수행 할 수 없습니다. 핀치 확대/축소를 위해 라이브러리 파일을 사용하고 줌 사양의 클래스를 만드는 것이 좋습니다