Zoomlayout: match_parent BUG

Created on 29 Sep 2018  ·  6Comments  ·  Source: natario1/ZoomLayout

When I try to set the child view width to match_parent, the view disappears.
I'm trying to add a layout as a child view.
please fix this.

wontfix

Most helpful comment

Facing same issue. Match parent is not working. UI is invisible.

All 6 comments

You must use wrap_content or a dp dimension

When using dp dimension the view appeared but not as I want. When I used wrap_content it is still invisible.
Perhaps that is not the suitable library in my case.
But great work, I've bookmarked it to use it in other cases.

Facing same issue. Match parent is not working. UI is invisible.

this issue still exists

Well it's currently not supported and there are probably reasons for that. I can't name them because @natario1 knows a lot more about this stuff than I do. If a solution is at least technically possible and @natario1 agrees, we can reopen this issue, although neither of us will investigate it anytime soon. But this is an open source GitHub project with no company backing it after all, so we are just a bunch of nerds working (hopefully) together. If you want to investigate it or even know how to fix it, we are very much open for PR's.

It might be possible, but it's not supported.

I have always thought as zoom was needed when we have a big content inside a small container, so we make the content small and enable zoom. In this context, a match_parent content makes no sense at all - if it fits, why zoom or scroll? We'll just make it look like match_parent with alignment and so on.

Just to mention one issue, if this was supported, you might declare as match_parent something that is actually bigger than the ZoomLayout dimensions, in which case it will appear shrinked, but zoomable... which is absurd in a 2D scrollable container.

So I don't see this as urgent or even needed, but feel free to work on it and open a PR.

Or simply do:

content.layoutParams.width = zoomLayout.width
content.layoutParams.height = zoomLayout.height
content.requestLayout()

This should be called after zoomLayout has computed a proper width and height (onGlobalLayout or something like that).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YiHaoHuang picture YiHaoHuang  ·  10Comments

lucasrsv picture lucasrsv  ·  3Comments

natario1 picture natario1  ·  13Comments

Yahor10 picture Yahor10  ·  5Comments

wakaztahir picture wakaztahir  ·  5Comments