Skip to content Skip to sidebar Skip to footer

Android Page Curl Effect On Layout/s

I am working on a project where I have to curl entire view/layout where I've textview, edittexts, buttons, etc. The task is that I have to curl the entire layout along with those b

Solution 1:

I have done so using the harism github project. All you need to do is grab a bitmap image of the layout by inflating it. Here is the code which replaces the loadBitmap function in the CurlActivity.java.

// Bitmap resources.privateint[] mBitmapIds = { R.layout.infopage0,R.layout.infopage1,
                             R.layout.infopage2, R.layout.infopage3 };

    @OverridepublicintgetPageCount() {
        return4;
    }

    private Bitmap loadBitmap(int width, int height, int index) {
        LayoutInflaterinflater= 
              (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        Viewv= inflater.inflate(mBitmapIds[index],null);
        v.measure(
                  MeasureSpec.makeMeasureSpec(width,MeasureSpec.EXACTLY),
                  MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
            v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
            Bitmapb= Bitmap.createBitmap(v.getWidth(), v.getHeight()
                    ,Bitmap.Config.ARGB_8888);
            Canvasc=newCanvas(b);
            v.draw(c);          
        return b;
    }

The array mBitmapIds is now an array of the xml layout id's.

Solution 2:

I have not worked over Curl effect but I have found a project for you which may help you.

https://github.com/harism/android_page_curl/

Post a Comment for "Android Page Curl Effect On Layout/s"