반응형
val backgroundColorCategoryPref = findPreference("backgroundColorCategory") as ListPreference
// 선택값 summary에 반영
backgroundColorCategoryPref.setOnPreferenceChangeListener { preference, newValue ->
if (preference is ListPreference) {
val index = backgroundColorCategoryPref.findIndexOfValue(newValue.toString())
backgroundColorCategoryPref.summary = backgroundColorCategoryPref.entries[index]
}
Log.d("선택한 배경색", backgroundColorCategoryPref.summary.toString())
true
}
val backgroundColorCategoryPref = findPreference("backgroundColorCategory") as ListPreference
// 선택값 summary에 반영
backgroundColorCategoryPref.setOnPreferenceChangeListener { preference, newValue ->
val index = backgroundColorCategoryPref.findIndexOfValue(newValue.toString())
backgroundColorCategoryPref.summary = backgroundColorCategoryPref.entries[index]
Log.d("선택한 배경색", backgroundColorCategoryPref.summary.toString())
true
}
반응형
'IT > Android' 카테고리의 다른 글
Kotlin] 안드로이드 앱 실행 시 전면 광고 넣기 (0) | 2020.04.08 |
---|---|
Kotlin] MultiSelectListPreference 선택값 summary에 반영 (0) | 2020.04.04 |
Kotlin] toast 메세지 // 배경, 글자 크기, 글자색 설정하기 (0) | 2020.03.31 |
Kotlin] 안드로이드 알람 설정 & 해제 (0) | 2020.03.29 |
Kotlin] 안드로이드 당겨서 새로고침 // SwipeRefreshLayout (0) | 2020.03.20 |
댓글