У меня есть макет main.xml с фиксированным верхним и нижним колонтитулами. Содержимое тела должно измениться в зависимости от полученных параметров.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#FFFFFF"
android:id="@+id/main_view">
<com.HeaderView
android:id="@+id/HeaderView"
android:layout_alignParentTop="true"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<com.FooterView
android:id="@+id/FooterView"
android:layout_alignParentBottom="true" android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/BodyView"
android:layout_below="@id/HeaderView"
android:layout_above="@id/FooterView"/>
</RelativeLayout>
В соответствии с приведенными ниже условиями мне нужно загрузить BodyView в main.xml.
If parameter == Apple
then load layout AppleView in the BodyView
if parameter == Bat
then load layout BatView in the BodyView
У меня определены макеты AppleView и BatView xml. Может кто-нибудь посоветовать мне, как я могу загрузить любое из представлений и установить / получить значения в / из него.