我有一个layout.xml
面板android(R.layout.items)
:包括来自其他布局的Android的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)
:
随着充气我只能添加r.layout
资源而不是r.id
。我想添加单个视图(例如panel1)到r.layout.other
。有任何想法吗?
我不能每一个面板保存在其他的XML,因为很多;是不是不可能从单个资源R.layout.items r.layout.other中添加dinamically到r.layout.other? – user2075861 2013-02-25 09:26:46
这是调用通用布局部分并包含在其他xml文件中的方式。 – 2013-02-25 09:34:36