简体   繁体   English

为什么我的listPreference对话框看起来不同?

[英]Why does my listPreference dialog look different?

I looked at several tutorials and all their listPreference dialogs look like this. 我看了几本教程,它们的所有listPreference对话框都像这样。

listPreference Dialog listPreference对话框

but my dialog looks like this 但是我的对话框看起来像这样

my dialog 我的对话

Any ideas why my dialog looks different? 为什么我的对话框看起来与众不同? I reviewed the tutorials and my xml code looks the same as theirs. 我查看了这些教程,并且我的xml代码与它们的相同。

Here is my pref_general.xml code. 这是我的pref_general.xml代码。

<?xml version="1.0" encoding="utf-8"?>

  <!-- NOTE: EditTextPreference accepts EditText attributes. -->
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
<EditTextPreference
    android:key="@string/pref_location_key"
    android:title="@string/pref_title_location"
    android:defaultValue="@string/pref_location_default"
    android:selectAllOnFocus="true"
    android:inputType="text"
    android:capitalize="words"
    android:singleLine="true"
    android:maxLines="1" />

<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
<ListPreference
    android:title="@string/pref_temperature_units_title"
    android:key="@string/pref_temperature_units_key"
    android:defaultValue="@string/pref_units_metric"
    android:entryValues="@array/pref_temperature_unit_values"
    android:entries="@array/pref_temperature_units"
    />

and part of the activity code 以及部分活动代码

public class SettingsActivity extends PreferenceActivity
    implements Preference.OnPreferenceChangeListener {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Add 'general' preferences, defined in the XML file
    addPreferencesFromResource(R.xml.pref_general);

    // For all preferences, attach an OnPreferenceChangeListener so the UI summary can be
    // updated when the preference changes.
    bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_location_key)));
    bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_temperature_units_key)));

}

I think you are testing in lollipop device. 我认为您正在棒棒糖设备中进行测试。 if you test below lollipop devices, it will look like first one.You can customize it like this ' How to customize list preference radio button ' 如果您在以下棒棒糖设备上进行测试,则它将看起来像第一个设备。您可以像这样“ 如何自定义列表首选项单选按钮 ”对其进行自定义

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的JButton在不同的计算机上看起来有所不同? - Why does my JButton look differently of different computers? 为什么我的JavaFX窗口到处看起来都不一样? - Why does my JavaFX window look different everywhere? 为什么我的源代码(用Eclipse编写)在其他文本编辑器中看起来不同? - Why does my source code (written in Eclipse) look different in other text editors? 为什么我的swing GUI在设计上看起来与运行时不同? - Why does my swing GUI look different in design than at run-time? 为什么我的GUI看起来不对劲? - Why does my GUI never look right? 为什么我的警报对话框没有打开? - Why does my Alert Dialog not open? 为什么我的 Android 对话框会抛出 NullPointer? - Why does my Android Dialog throw a NullPointer? 为什么我的JPanel在具有特定大小的情况下显示为灰色,而在没有其他大小的情况下却显示为灰色? - Why does my JPanel look gray with a certain size but not with another? 为什么我的RichJLabel文本的一部分看起来被覆盖/隐藏了? - Why does part of my RichJLabel text look covered/hidden? Android,单击 ListPreference 项时显示对话框 - Android, show dialog when ListPreference item is clicked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM