我已经在本地iOS
平台上开发了一个应用程序,可以从plist中读取用户设置。
string settingsBundle = NSBundle.MainBundle.PathForResource ("Settings.bundle/Root", @"plist");
NSDictionary dic = NSDictionary.FromFile (settingsBundle);
我想知道在Android
或Xamarin.Android
您可以将默认用户设置放在preferences.xml中:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="pref_sync"
android:title="@string/pref_sync"
android:summary="@string/pref_sync_summ"
android:defaultValue="true" />
<ListPreference
android:dependency="pref_sync"
android:key="pref_syncConnectionType"
android:title="@string/pref_syncConnectionType"
android:dialogTitle="@string/pref_syncConnectionType"
android:entries="@array/pref_syncConnectionTypes_entries"
android:entryValues="@array/pref_syncConnectionTypes_values"
android:defaultValue="@string/pref_syncConnectionTypes_default" />
</PreferenceScreen>
并像这样阅读:
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String syncConnPref = sharedPref.getString(SettingsActivity.KEY_PREF_SYNC_CONN, "");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句