I get the data and add a TextView in a loop, I can specify the internal indent, but there is a problem with the external indent))
Here is the code as I do:
for (int i = 0; i < response.body().getInterests().getInterests().size(); i++) { com.google.android.flexbox.FlexboxLayout interestsLayout = (com.google.android.flexbox.FlexboxLayout) findViewById(R.id.interestsLayout); TextView interestsTextView = new TextView(UserPageActivity.this); interestsTextView.setText(userData.getInterests().getInterests().get(i).toString()); interestsTextView.setBackgroundResource(R.drawable.circle_button_gray); interestsTextView.setPadding(10,10,10,10); LinearLayout.LayoutParams textViewLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); textViewLayoutParams.setMargins(8,8,8,8); interestsTextView.setLayoutParams(textViewLayoutParams); interestsLayout.addView(interestsTextView); } Thank!
textViewLayoutParams.setMargins(16,16,16,16);- McDaggen