content: package com.cjj.mousepaint;
  
  import android.annotation.TargetApi;
  import android.app.FragmentManager;
  import android.os.Build;
  import android.os.Bundle;
  import android.preference.PreferenceFragment;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.AppCompatActivity;
  import android.widget.FrameLayout;
  
  import com.cjj.mousepaint.utils.StatusBarCompat;
  
  /**
   * Created by Administrator on 2015/11/20.
   */
  public class SettingActivity extends AppCompatActivity {
  
      private SettingsFragment mSettingsFragment;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_setting);
          StatusBarCompat.compat(this, getResources().getColor(R.color.brownness));
          if (savedInstanceState == null) {
              mSettingsFragment = new SettingsFragment();
              replaceFragment(R.id.fl_setting, mSettingsFragment);
          }
      }
  
      @TargetApi(Build.VERSION_CODES.HONEYCOMB)
      public void replaceFragment(int viewId, android.app.Fragment fragment) {
          FragmentManager fragmentManager = getFragmentManager();
          fragmentManager.beginTransaction().replace(viewId, fragment).commit();
      }
  
      public static class SettingsFragment extends PreferenceFragment {
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              addPreferencesFromResource(R.xml.preferences);
          }
      }
  
  }
  