Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

View shrinks #1

Open
ja1984 opened this issue May 15, 2015 · 6 comments
Open

View shrinks #1

ja1984 opened this issue May 15, 2015 · 6 comments

Comments

@ja1984
Copy link

ja1984 commented May 15, 2015

Hi,

The library works great (thanks btw!) except for one little issue. When I make an image from my app is shrinks the view. Here is an before and after.

screenshot_2015-05-15-11-36-07
screenshot_2015-05-15-11-36-12

@cielantropi
Copy link

any update on this? thanks.

@vipulasri
Copy link
Owner

No, I want help in correcting this.

@okernel
Copy link

okernel commented Dec 22, 2015

@vipulasri I think that the problem is @cielantropi invoke your code in one method.Something like above code segment.

  void submit() {

        String picName = getRandomString(8);

        saveBitmap(picName, convertViewToBitmap(cardFrame));
        scanPhoto(MainActivity.this, picName);

        Layout_to_Image layout_to_image;  //Create Object of Layout_to_Image Class

        LinearLayout relativeLayout;   //Define Any Layout

        Bitmap bitmap;                  //Bitmap for holding Image of layout

        //provide layout with its id in Xml

        relativeLayout = (LinearLayout) findViewById(R.id.card_frame);

        //initialise layout_to_image object with its parent class and pass parameters as (<Current Activity>,<layout object>)

        layout_to_image = new Layout_to_Image(MainActivity.this, relativeLayout);

        //now call the main working function ;) and hold the returned image in bitmap

        bitmap = layout_to_image.convert_layout();
//
    }

@okernel
Copy link

okernel commented Dec 22, 2015

@vipulasri In my opnion,used buildDrawingCache method isn't a best way to convert a view to bitmap.If a view like ScrollView that includes lots of views,you will fail in it.

@vipulasri
Copy link
Owner

@okernel i will look into it your valuable suggestion.

@okernel
Copy link

okernel commented Dec 24, 2015

@vipulasri

        Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),
                Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        view.draw(canvas);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants