1
我可以在佈局中包含偏好,例如我們如何使用<include layout=""/>
標籤將佈局包含在另一個佈局中。如何在佈局中包含偏好
我的佈局代碼是這樣
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity" />
<include layout="@layout/settings"/>
<!-- <include layout="@xml/set_variables"/> -->
</LinearLayout>
在上面的佈局我試圖包括偏好@xml/set_variables
,但如果我取消<include layout="@xml/set_variables"/>
我的應用程序會崩潰。請任何人建議有沒有辦法在佈局中包含偏好或只是我應該忘記這一點。