Привет, у меня есть простой пользовательский просмотр с названием Group < /code>: < /p>
public class Group extends LinearLayout {
private TextView headerTextView;
public Group(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs,
R.styleable.Group, 0, 0);
String string = typedArray.getString(R.styleable.Group_headerText);
typedArray.recycle();
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.widget_group, this, true);
headerTextView = (TextView) v.findViewById(R.id.header_text);
headerTextView.setText(string);
}
}
< /code>
И я хочу динамически создать его в активности. Я хочу установить свой атрибут атрибута. Это не правильный способ создания объекта.
Мне нужен пример того, как эта область < /p>
Group g = new Group(v.getContext(),arrt);
< /code>
просто не знал, как установить объект ARRT и установить мой пользовательский атрибут в нем < /p>
Подробнее здесь: https://stackoverflow.com/questions/189 ... mmatically