Ich habe die Anleitung "Einstellungen" von Android-Entwicklern gefolgt. Aber wenn ich meine SettingsActivity starte, bekomme ich nur weißen Bildschirm. Was mache ich falsch?Wie Einrichten von Einstellungen Aktivität in Android Studio?
Hier ist meine SettingActivity.java
public class SettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment())
.commit();
}
}
Hier ist SettingFragment
public class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
}
}
Hier Vorlieben
Datei ist<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<EditTextPreference android:title="Your Name"
android:key="username"
android:summary="Please provide your username"></EditTextPreference>
<CheckBoxPreference android:title="Application Updates"
android:defaultValue="false"
android:summary="This option if selected will allow the application to check for latest versions."
android:key="applicationUpdates" />
<ListPreference android:title="Download Details"
android:summary="Select the kind of data that you would like to download"
android:key="downloadType"
android:defaultValue="1"
android:entries="@array/listArray"
android:entryValues="@array/listValues" />
</PreferenceScreen>
Und das ist, wie ich zu SettingsActivity wechseln
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(intent);
Soll weißer Bildschirm auftreten? Ich erwarte einen Standardbildschirm mit Einstellungen
posten Sie Ihre Stil –
wo „ist“ SettingsTheme? –
Sie es einrichten können, was Sie wollen, IntelliJ Amiya, ist mein –