<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/item_layout" android:weightSum="1"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/item_text" android:layout_weight="0.15" android:text="plain text"/> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1111222" android:id="@+id/Button1" /> <Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="111" android:id="@+id/Button2" /> </LinearLayout> </LinearLayout>
I have such a template, I need to display new elements based on this template, simultaneously setting values for TextView. I also need to hang OnclickListener on the buttons and then change their text, that is, the ArrayAdapter will not help me here.
I did it programmatically, but it's not convenient for me to customize the design.
How to clone this block to have access to its elements?