私はmain_layout.xmlルートレイアウトとして持っていますが、それがRelativeLayoutまたはLinearLayout. そして、そのルート レイアウトには独自の異なるレイアウトがあります。基本的には次のようになります。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/default_background" >
<RelativeLayout
android:id="@+id/panel_bar">
<!-- -->
</RelativeLayout>
<RelativeLayout
android:id="@+id/other_bar">
</RelativeLayout>
<RelativeLayout
android:id="@+id/main_bar">
<Button id="@+id/change_button" />
</RelativeLayout>
</RelativeLayout>
クリックしchange_buttonたら、別のレイアウトに変更したいpanel_bar、としましょうanother_layout。ちなみに、another_layout別ファイルの既存のレイアウトです。両方とも (panel_barとanother_layout) 同じ身長と体重です。私はそれらを切り替えたいだけです。
私の考えは正しくないかもしれません。別のアプローチが必要かもしれません。私はあなたの提案について本当に興味があります. どんな助けでも素晴らしいでしょう。