public class SystemSettingPreference extends PreferenceActivity { protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.system_setting); } public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { // TODO Auto-generated method stub super.onPreferenceTreeClick(preferenceScreen, preference); Preference tmp_pre = (Preference)manager.findPreference(preference.getKey()); //判断是否是EditTextPreference if(tmp_pre instanceof EditTextPreference) { tmp_pre = (EditTextPreference) tmp_pre; EditText ed = ((EditTextPreference) tmp_pre).getEditText(); Editable etable = ed.getText(); Selection.setSelection(etable, etable.length());//光标置位 } return true; } }