1

i run the yogalayout android sample https://github.com/facebook/yoga/tree/master/android/sample

this sample's layouts use xml like

<com.facebook.yoga.android.YogaLayout>
    <ImageView />
    <ImageView />
</com.facebook.yoga.android.YogaLayout>

i want to use java code to write layout,but how to write?
YogaNode just calculate the layoutX and layoutY , how to add view to its parent?
i see the source code,and found i can get the layout's YogaNode
and use it to set params
such as node.setFlexXXXXXX()

so, now i write code like this:

layout.addView(view);//addView to YogaLayout
node =  ((YogaLayout)layout).getYogaNode().getChildAt(layout.indexOfChild(view));//get Node
node.setFlexDirection();//set params

but VirtualYogaLayout doesnt work
when add virtualyogalayout it clears its children
can someone give me a sample?

0 Answers0