TextView는 개행 기준이 어절이여서 음절로 바꾸기 위해 replace(" ", "\u00A0")가 필요하다.
Activity내에 모든 TextView를 바꾸기 위해선 rootView를 돌려서 찾아주면 끝.
try {
viewDataBinding.run {
(root as ViewGroup).allViews.forEach {
if (it is TextView) {
it.text = it.text.toString().replace(" ", "\u00A0")
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
'안드로이드' 카테고리의 다른 글
[android] TextView 줄바꿈2 - justificationMode (0) | 2024.01.17 |
---|---|
[playstore] 앱 사용자 확인하기 (통계) (0) | 2024.01.12 |
[android] CoordinatorLayout 안에서 버튼 클릭으로 Recycerview item 이동 (0) | 2023.10.27 |
[android] getSerializableExtra deprecated (0) | 2023.03.07 |
[android studio] configuration-cache 문제해결 (0) | 2023.03.02 |
댓글