Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Resize scratchview programatically #18

@maneca

Description

@maneca

Hello,

First of all, thank you for the work you have made by creating this library. It is great!

I have an issue. I have been trying to resize the view that holds the image to scratch but I cannot reset the values for the height or the width. I can reset the margins but I can't resize it. Can you help me?

Here is my code:

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
float y_factor = (float) ((double) height)/720;
float x_factor = (float) ((double) width)/1196;
ImageMargins next_image_margins = margins[next_image];

params.setMargins(Math.round((next_image_margins.getLeft()) * x_factor),Math.round((next_image_margins.getTop()) * y_factor),Math.round((next_image_margins.getRight()) * x_factor),Math.round((next_image_margins.getBottom()) * y_factor));

to_erase.setLayoutParams(params);
to_erase.getLayoutParams().height = 2000;
to_erase.getLayoutParams().width = 500;

to_erase.requestLayout();
to_erase.setScratchAll(false);
updatePercentage(0f);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions