Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Flexbox-layout: Flexbox for Android (github.com/google)
45 points by tilt on May 6, 2016 | hide | past | favorite | 7 comments


This was much needed. I feel a bit disgusted to look at the attributes naming though. I dont work a lot with XML but why should an attribute be "layout_alignSelf"

and not

"layoutAlignSelf" or "layout_align_self" ?

This is a general rant and nothing specific to Flexbox.


The "layout_*" attributes are a bit special in that they are specified on an element, but are provided by the element's container. Rather than affecting the element and its children, such attributes affect the element's relationship with its container/siblings. So in this case, the attribute is "alignSelf", but it is defined and understood by FlexboxLayout rather than the TextView that specifies it.

Perhaps this isn't the best implementation of such namespacing (maybe they could've done something more with xmlns?) but I find the visual and semantic distinction useful when reading and writing layouts.


Is this distinction documented somewhere?


Not very well, but you can start with [1] and explore the LayoutParams hierarchy from there.

[1] http://developer.android.com/guide/topics/ui/declaring-layou...


The XML attribute naming in Android general is all over the place. A mix of camel and snake case.


Couldn't this have built upon https://github.com/facebook/css-layout ?


its funny, I was searching for a library doing this a day ago :) I guess this is going to be mainstream soon, once the windowed mode gets out :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: