0
저는 listView 활동이 있으며 사용자가 지정한 일부 기본 설정을 적용하고 저장해야합니다. 내 ListView의 각 행에는 두 개의 TextView (연도 및 국가)가 포함되어 있습니다.OnSharedPreferenceChangeListener 구현
내가 onSharedPreferenceChanged 이벤트 이런 식으로 처리 :
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(new SharedPreferences.
OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs,
String key) {
TextView year = (TextView) findViewById(R.id.year);
year.setTextSize(Float.parseFloat(prefs.getString(key, null)));
TextView country = (TextView) findViewById(R.id.country);
country.setTextSize(Float.parseFloat(prefs.getString(key, null)));
}
});
을하지만 변화가 첫 번째 행에 대해서만 적용됩니다, 나머지는 이전과 동일하게 유지.
목록의 각 행에 새로운 설정을 적용하려면 어떻게해야합니까? 귀하의 답변에 감사드립니다.