谢了这样的代码:this.getPreferenceManager().setSharedPreferencesName("preference");但是preference。xml显示不出来

解决方案 »

  1.   

    你是说修改了sharedpreferences,然后保存么?
    不能这样保存。
    用getEditor().commit();
    才能保存
      

  2.   

    this.getPreferenceManager().inflateFromResource(this, R.xml.preference,getPreferenceScreen())
      

  3.   

    顶,曾经没用COMMIT,还以为程序有问题
      

  4.   

    看看你的PreferenceActivity里面的onPreferenceChange()方法,是不是没有return true阿。
    public abstract boolean onPreferenceChange (Preference preference, Object newValue)Since: API Level 1
    Called when a Preference has been changed by the user. This is called before the state of the Preference is about to be updated and before the state is persisted.
    Parameterspreference The changed Preference.
    newValue The new value of the Preference.
    ReturnsTrue to update the state of the Preference with the new value.