對不起,這個例子可能會解決這個問題。我正在嘗試爲其他佈局文件設置內部佈局。爲了簡單起見,我製作了這些全部線性佈局,但總的來說,我更喜歡它是任何類型的佈局。鑑於main_layout.xml,我可以將內部LinearLayout(chooseLayout)設置爲layout_1.xml或layout_2.xml,具體取決於按下按鈕嗎?根據按鈕按壓,可以選擇佈局文件放入主佈局的內部佈局中嗎?
例子:
layout_1.xml - 小版面1
layout_2.xml - 小版面2
main_layout.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">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/chooseLayout"
>
</LinearLayout>
</LinearLayout>
曾任職完美,再次感謝! – Ghastone