0

main.xmlとcustom.xmlがあります

custom.xmlをユーザーコントロールのようにしたいので、次のように2つのタグをmail.xmlに配置しました。

<?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"
    android:background="#FFFFFF" >

     <custom
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_height="wrap_content"
         android:layout_width="fill_parent" />

     <custom
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_height="wrap_content"
         android:layout_width="fill_parent" />

</LinearLayout>

しかし、それは機能しません。

4

1 に答える 1

1

代わりにincludeタグを試してください。

<include layout="@layout/custom"
    android:id="@+id/custom1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
于 2012-09-28T16:41:11.680 に答える