flexbox-layout icon indicating copy to clipboard operation
flexbox-layout copied to clipboard

getflexlines delay

Open charmeleon2 opened this issue 6 years ago • 1 comments

  • [ ] I have searched existing issues and confirmed this is not a duplicate

Issues and steps to reproduce

when i add view, i want to get lines,but result seems to delayed. so i add another clickevent to check the result ,it's right.

Expected behavior

after add a view, getflexlines method return the right lines

Version of the flexbox library

1.0.0

public void add() { int flexItemCount = flexboxLayout.getFlexItemCount(); TextView textView = new TextView(this); textView.setText(Integer.toString(flexItemCount)); textView.setPadding(SizeUtils.dp2px(30f), SizeUtils.dp2px(5f), SizeUtils.dp2px(30f), SizeUtils.dp2px(5f)); textView.setBackgroundColor(Color.parseColor("#708090")); flexboxLayout.addView(textView); int count = flexboxLayout.getFlexItemCount(); Log.d("FLEX1",count+""); List<FlexLine> flexLines = flexboxLayout.getFlexLines(); Log.d("FLEX1",flexLines.size()+""); }

public void change(View view) { List<FlexLine> flexLines = flexboxLayout.getFlexLines(); Log.d("FLEX2",flexLines.size()+""); }

charmeleon2 avatar Apr 08 '19 15:04 charmeleon2

For example,when i add the third line's first item, getflexline return 2,but getflexitemcount return the right result. On change method, getflexlines return 3. 18

charmeleon2 avatar Apr 08 '19 15:04 charmeleon2