Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match_parent BUG #54

Closed
MohamedMedhat1998 opened this issue Sep 29, 2018 · 6 comments
Closed

match_parent BUG #54

MohamedMedhat1998 opened this issue Sep 29, 2018 · 6 comments

Comments

@MohamedMedhat1998
Copy link

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.

@natario1
Copy link
Owner

You must use wrap_content or a dp dimension

@MohamedMedhat1998
Copy link
Author

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.

@sh3lan93
Copy link

this issue still exists

@markusressel
Copy link
Collaborator

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.

@natario1
Copy link
Owner

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).

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

No branches or pull requests

5 participants
@sh3lan93 @MohamedMedhat1998 @markusressel @natario1 and others