Skip to content

Analogue to clipToPadding (or reimplement cropToPadding) to let the image be padded but still scrollable/zoomable beyond the padding. #671

@entdark

Description

@entdark

Currently with any set padding the image is scaled to fit the padding when its non-zoomed and gets clipped by the padding when it's zoomed in.

I'd like to have the image padded like it is now in the non-zoomed state but when zoomed the image is drawn beyond the padding and when scrolled to any edge the padding will be a part of the scrollable content.

The best representation of that effect is RecyclerView + android:clipToPadding="false" attribute with given vertical padding (in case of vertical scrolling). The content of RecyclerView is padded when it reaches the top or bottom. Basically the padding is part of the drawn content. That SO answer has a video demonstrating the effect: https://stackoverflow.com/a/46710968
There is also android:cropToPadding property of ImageView but it has no effect unfortunately.

I understand that the project is in the maintenance mode so maybe one can guide me how could I achieve that myself. I actually made some attempts and they were fine for the bottom and right paddings where I just added padding to imageWidth and imageHeight. But things go harder when need to apply padding to top and left because it requires to properly adjust matrix translation that I fail to do.

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