0

I want to have zoom ability using this library :

https://github.com/MysticTreeGames/android-page-curl

and for zooming I want to use following library

https://github.com/sephiroth74/ImageViewZoom

the ImageViewZoom provides a frameLayout which means I can add a page-curl view inside it.

But when I do such, all I get is a blank screen on my page.

here is my layout :

<?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" >
    <com.mystictreegames.pagecurl.PageCurlView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/dcgpagecurlPageCurlView1"
        android:background="@drawable/bbb1">
    </com.mystictreegames.pagecurl.PageCurlView>

    </pl.polidea.view.ZoomView>

and this the code I use to attach the zoomView inside my actual layout :

View zv = ((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE))
                .inflate(R.layout.zoomable,null,false);
        zv.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT
        ));




        ZoomView zoom = new ZoomView(this); //current activity
        zoom.addView(zv);

How can I combine these two together?

Vahid Hashemi
  • 5,182
  • 10
  • 58
  • 88

1 Answers1

1

I know this zooming library is very popular, however IMHO the best way to implement image zoom in android is to load the images inside a webview. The code for this is simple and straight forward and the platform provides all the zooming functionality.

    String html = "<html><body>Hello, World!<br/><img src='http://farm4.static.flickr.com/3531/3769416703_b76406f9de.jpg' /></body></html>";
    String mime = "text/html";
    String encoding = "utf-8";

    WebView myWebView = new WebView(mContext);
    myWebView.getSettings().setBlockNetworkImage(false);
    myWebView.getSettings().setBlockNetworkLoads(false);
    myWebView.loadDataWithBaseURL(null, html, mime, encoding, null);
Ali
  • 12,354
  • 9
  • 54
  • 83
  • Thanks Ali, I saw this but my problem is curling. I have no clue how to combine curling with webView! beside that webview is memory hungry isn't it? – Vahid Hashemi Dec 25 '13 at 06:48
  • 1
    Not sure about the memory issue, what you could do (though it's slow) is do a screen grab of your app and show that bitmap over all the content. Then hide your content in the background or replace it with the new content and do the page-curl with the bitmap (which shows the original page content). – Ali Jan 02 '14 at 12:27