마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

ImageView focusable true 가 되는 경우가 어떤 경우가 있나요?

0 추천
ImageView 의 경우 기본 focusable값이 false인것으로 알고 있는데요.

xml에 android:focusable="true"를 넣지 않고 .java 나 .kt에서 어떤 이벤트를 적용할때 focusable="true"로 바뀌게 되나요?

예를 들어 xml에서 android:clickable="true"를 적용하지 않고 .java 나 .kt에서 setOnClickListener 를 적용하면 UiAutomater로 클래스 확인시 clickable="true" 로 옵션이 나옵니다

focusable="true"는 어떤 경우에 그러할까요?
백지장 (140 포인트) 님이 2022년 5월 9일 질문

1개의 답변

0 추천

스택오버플로우에 있는 답을 가져와 봤습니다.

Clickable means that it can be clicked by a pointer device or be tapped by a touch device. Focusable means that it can gain the focus from an input device like a keyboard. Input devices like keyboards cannot decide which view to send its input events to based on the inputs itself, so they send them to the view that has focus.

Focusable은 포커스를 받을 수 있다는 의미이고, 이건 키보드와 관련이 있고, EditText와 같은 뷰는 어느 시점에 입력이벤트를 보내야할지 결정할 수 없기 때문에 focus가 있을 때 입력이벤트를 발생시키게 되는 거라고 합니다.

spark (226,720 포인트) 님이 2022년 5월 9일 답변
...