본문 바로가기
IT/Android

Kotlin] toast 메세지 // 배경, 글자 크기, 글자색 설정하기

by 깻잎쌈 2020. 3. 31.
반응형
// 배경은 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.getColor(R.color.colorWhite))

반응형

댓글