У меня есть layout.xml
панель в android(R.layout.items)
:включают LinearLayout от другого макета андроида
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="textview1: " />
<LinearLayout
android:id="@+id/Panel1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal"
android:padding="1dp" >
<EditText
android:id="@+id/agente2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:maxLength="5"
android:singleLine="true" />
<EditText
android:id="@+id/agente2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:enabled="false"
android:singleLine="true" >
</EditText>
<LinearLayout
android:id="@+id/Panel2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal"
android:padding="1dp" >
<CheckBox
android:id="@+id/cbTipoIncidente1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CheckBox" />
.....
В этой панели у меня есть некоторые linearlayout
, что я хочу, чтобы добавить динамически и программно другому layout(r.layout.other)
:
С Inflate I может добавить только r.layout
ресурсов, а не r.id
. Я хотел бы добавить отдельный вид (например, panel1) в r.layout.other
. Есть идеи?
Я не могу спасти каждую панель в другие XML, потому что много; не может быть добавлено динамически из единственного res R.layout.items r.layout.other to r.layout.other? – user2075861
Это способ вызова общей части макета и включения в другие XML-файлы. –