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

Gravity issues #29

Open
Namnodorel opened this issue May 21, 2016 · 5 comments
Open

Gravity issues #29

Namnodorel opened this issue May 21, 2016 · 5 comments

Comments

@Namnodorel
Copy link

The layout_gravity="right" and layout_gravity="left" (or start/end) don't work for children of a FlowLayout.

@yisizhu520
Copy link

This FlowLayout just supports horizontal flow layout, so it doesn't make sense that the children of a horizontal FlowLayout use "start/left" or "end/right" layout_gravity.

@Namnodorel
Copy link
Author

It does make sense when in the flowlayout there are three items, and the third doesn't fit in the row, but there's still some space left. By supporting gravity, this space wouldn't always be at the end of the second item but maybe in the middle or at the start of the first one.

@yisizhu520
Copy link

oh, I get your point now. It's really userful in some situations. But It's a little complicated to layout all children if the attr layout_gravity = "left/right" is supported in each child of a FlowLayout. Maybe it is more reasonable to support the attr layout_gravity = "left/right" for each row rather than each child?

@Namnodorel
Copy link
Author

The whole point of the FlowLayout is that the rows and in which row the elements are positioned are determined dynamically, so I don't see how it could be useful (or implemented) to have this feature. You don't know/control, how many rows there are, which elements are in which row, etc. You could do something like

if(flowLayout.getRows().size() > 1 && flowLayout.getRows().get(1).contains(elementX){ flowLayout.getRows().get(1).setGravity(Gravity.RIGHT); }

but this would be complicated to implement and make it nessecary to modify the FlowLayout in-code to achive the wanted effect. At the moment, you can do anything you want just using XML.

@yisizhu520
Copy link

yeah, I agree with your idea. You can hava a look at the FlexBoxLayout library provided by Google recently. Maybe it can help you.

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

No branches or pull requests

2 participants