Есть xml разметка которая должна многократно использоваться на одном экране приложения. Разметка содержит три textview. Как создать собственный view элемент из этой разметки, с возможностью задавать значения в любой textview?
Код разметки:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/parametr"
android:textSize="13sp"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/value"
android:textSize="13sp"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edizm"
android:textSize="13sp"
android:layout_weight="1"/>
</LinearLayout>
View view = LayoutInflater.from(context).inflate(R.layout.layout_name, null);
Устанавливать значение в любой текст вью:((TextView) view.findViewById(R.id.parametr)).setText("Some Text");
– eugeneek 25 авг '17 в 12:23