void setLabelsText() { // remove all first final int childCount = panelLabels.getChildCount(); if (childCount > 1) { panelLabels.removeViews(1, childCount - 2); } int pos = 1; for (Label label : labels) { panelLabels.addView(getLabelView(label), pos++); } }
private View getLabelView(Label label) { TextView res = (TextView) LayoutInflater.from(context).inflate(R.layout.label_x, null); res.setLayoutParams(panelLabels.generateDefaultLayoutParams()); res.setText(label.title); res.setTag(R.id.TAG_label, label); res.setOnClickListener(lJudul_click); U.applyLabelColor(label, res); return res; }