I have a preference xml in xml/preferences.xml:
<EditTextPreference
android:key="welcome_message"
android:title="Welcome message"
android:summary="Default welcome message"
android:dialogTitle="Tervetuloa-viesti"
android:dialogMessage="Input"
android:defaultValue="Default message" />
I know how to get the welcome_message from the preferences by code, but can I do it in XML something like:
<TextView android:id="@+id/txt" android:layout_width="wrap_content" android:text="(INCLUDE welcome_message HERE)" android:layout_height="wrap_content" />
in my main.xml and if so, how? Thanks.
据我所知,您不能直接从xml布局中引用首选项值。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.