Open charmeleon2 opened 5 years ago
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.
after add a view, getflexlines method return the right lines
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 flexLines = flexboxLayout.getFlexLines(); Log.d("FLEX1",flexLines.size()+""); }
public void change(View view) { List flexLines = flexboxLayout.getFlexLines(); Log.d("FLEX2",flexLines.size()+""); }
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.
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 flexLines = flexboxLayout.getFlexLines();
Log.d("FLEX1",flexLines.size()+"");
}
public void change(View view) { List flexLines = flexboxLayout.getFlexLines();
Log.d("FLEX2",flexLines.size()+"");
}