본문 바로가기

Android

[android]EditText without cursor _ EditText에서 커서 제거

TextView에 ScrollView를 달고 싶을 때 간단하게 EditText를 이용.


1. android:background="@null"

- Android Style 지정 시 EditText 하단에 표식이 생기는 것을 없애준다.


2. android:editable="false" >> android:inputType="none"

- editable 선언 시 inputType으로 대체하라고 나오는데, inputType을 사용해도 edit가 가능하다..(검색하다보면 bug라는 말이 있다.)


3. android:focusable="false"

- 터치 시 focus가 가지 않는다.(이전 control에서 imeOption이 ActionNext일 경우도 건너뛴다.)


4. android:focusableInTouchMode="false"

android:focusable="false"와 같다. TouchMode 시에 focusing하지 않는다는데, android:focusable="false"와 차이점을 모르겠다.

  일단은 android:focusable="false"와 같이 사용.


5. android:cursorVisible="false"

- 1~4번을 사용할 경우 focus가 되지 않지만, EditText에 롱클릭 시 포커스가 생긴다. 5번을 사용해야 focus 자체가 생성되지 않는다.


* 1번은 선택 2은 제외, 3~4는 하나만 써도 일단은 적용됨, 5번 필수.(단 아래 코드를 적용해도 하단부까지 스크롤 했을 때 롱클릭을 하면 EditText가 최상단으로 올라온다. _ 그러기 싫으면 TextView에 ScrollView를 감싸는걸 추천)