728x90
반응형
Layout
먼저 layout 파일로 들어간 다음, 밑줄을 제거하고 싶은 EditText의 속성에 다음 한 줄을 추가해준다.
<EditText
...
android:background="@null"
.../>
background에 아무것도 넣지 않음으로 밑줄도 사라지게 된다.
Kotlin
런타임에서 동적으로 나타나게하거나 사라지게 하고 싶다면 다음과 같이 해준다.
val defaultBackground = binding.editText.background //밑줄이 있는 백그라운드를 따로 저장
if (case == "INVISIBLE_UNDERLINE") {
binding.editText.background = null
} else if (case == "VISIBLE_UNDERLINE") {
binding.editText.background = defaultBackground
}
이런식으로 런타임에서 EditText의 밑줄을 나타내거나 사라지게 할 수 있다.
728x90
반응형
'Android' 카테고리의 다른 글
| [Android] Notification Channel 알림 채널 만들기 (0) | 2021.10.18 |
|---|---|
| [Android] 배포용 앱 개발시 주의할 점 (0) | 2021.10.09 |
| [Android/Mac] Mac에서 안드로이드 스튜디오 설치하기 (0) | 2021.10.09 |
| [Android] DataBinding(ViewBinding) 적용법 (0) | 2021.10.09 |
| [안드로이드] 이미지뷰 흑백으로 만들기 (0) | 2021.09.24 |