2
이 부분은 flexbox layout입니다. 나는 행동이 달라 붙어있다. 동적으로 추가 된 항목이 FlexboxLayout
에 맞지 않으면 항목을 다음 줄에 표시하려고합니다. 인 flexbox이 내용을 축소,android : flexbox 포장 내용이 없습니다
private void generateCategories(UserCategoryListResponse userCategoryListResponse) {
for (UserCategoryListResponse.Datum data : userCategoryListResponse.getData()) {
mFlexboxLayout.addView(getCategoryRadioButton(data));
}
}
private RadioButton getCategoryRadioButton(UserCategoryListResponse.Datum data) {
RadioButton radioButton = new RadioButton(this);
radioButton.setId(Integer.parseInt(data.getCategoryId()));
radioButton.setBackgroundResource(R.drawable.selector_choose_category);
radioButton.setButtonDrawable(null);
radioButton.setPadding(DisplayUtils.pxToDp(this, 16), DisplayUtils.pxToDp(this, 16), DisplayUtils.pxToDp(this, 16), DisplayUtils.pxToDp(this, 16));
radioButton.setText(data.getCategoryName());
radioButton.setTypeface(radioButton.getTypeface(), Typeface.BOLD);
radioButton.setEnabled(data.getIsFree().equals("1"));
radioButton.setOnCheckedChangeListener(this);
return radioButton;
}
그러나 실제로 일어나고있는 것입니다 :
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/fbl_choose_category_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin_16"
android:paddingLeft="@dimen/padding_16"
android:paddingRight="@dimen/padding_16"
app:alignContent="space_between"
app:alignItems="flex_start"
app:flexDirection="row"
app:flexWrap="wrap"
app:justifyContent="space_between">
</com.google.android.flexbox.FlexboxLayout>
내 자바 코드 :
Flexbox Version: 0.2.2
누구든지이 문제를 해결할 수 있다면.
예 이렇게하면 제 대안 솔루션이 될 수 있습니다. –