IT/Android101 Kotlin] ListPreference 선택값 summary에 반영 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... 2020. 4. 4. Kotlin] toast 메세지 // 배경, 글자 크기, 글자색 설정하기 // 배경은 toast_background val toast = Toast.makeText(applicationContext, R.string.all_done_message, Toast.LENGTH_LONG) val view = toast.view view.setBackgroundResource(R.drawable.toast_background) // 글자 크기 36f, 글자색 white val group = toast.view as ViewGroup val msgTextView = group.getChildAt(0) as TextView msgTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36f) msgTextView.setTextColor(resources... 2020. 3. 31. Kotlin] 안드로이드 알람 설정 & 해제 알람설정 val intent = Intent(AlarmClock.ACTION_SET_ALARM) intent.putExtra(AlarmClock.EXTRA_HOUR, myHour) // 시간 설정 intent.putExtra(AlarmClock.EXTRA_MINUTES, myMinute) // 분 설정 intent.putExtra(AlarmClock.EXTRA_MESSAGE, "아알람") // 메세지 설정 intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true) // ui없이 바로 알람 저장 startActivity(intent) 알람 해제 val intent = Intent(AlarmClock.ACTION_DISMISS_ALARM) intent.putExtra(AlarmCl.. 2020. 3. 29. Kotlin] 안드로이드 당겨서 새로고침 // SwipeRefreshLayout build.gradle 추가해주고 dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" } activity_main.xml MainActivity.kt // 당겨서 새로고침 pullToRefresh.setOnRefreshListener { //새로고침 내용 items.clear() . . // 새로고침 중지 // 없으면 새로고침 애니메이션 끝나지 않음 pullToRefresh.isRefreshing = false } https://javapapers.com/android/android-swipe-down-to-refresh-a-listview/ Android Swipe Down to Refresh a Lis.. 2020. 3. 20. 이전 1 ··· 20 21 22 23 24 25 26 다음