본문 바로가기
카테고리 없음

[방광곡곡] 전화번호 클릭시 키패드 연결

by eyes from es 2024. 12. 6.
728x90
반응형

1️⃣  의도

- 기능 :  클릭 시 전화 앱이 열리고 전화번호가 키패드에 입력된 상태.

- 레이아웃 : 레이아웃에서도 전화번호 클릭할 수 있도록 표시가 되어야 함.

 

<TextView
                        android:clickable="true"
                        android:focusable="true"
                        android:autoLink="phone" <!-- 전화번호 자동 인식 -->
                        android:textColorLink="@color/subColor" <!-- 클릭 시 색상 -->

                        android:paddingLeft="12dp"
                        android:id="@+id/toilet_manageOffice_number"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:gravity="center_vertical"
                        android:text="02 - 450 - 1234"
                        android:textColor="@color/mainColor"
                        android:textSize="17sp"
                        android:textStyle="bold" />

적용 전 (좌), 적용 후 (우)

 

 

 

📌  focusable과 clickable의 차이점

  • focusable:
    • 뷰가 포커스를 받을 수 있도록 허용합니다. 키보드나 접근성 도구에서 탐색 가능.
  • clickable:
    • 뷰가 클릭 이벤트를 받을 수 있도록 설정합니다. 터치나 클릭 동작에 반응.

둘을 함께 설정하면 UI 요소가 더 상호작용 가능해집니다:

android:focusable="true"
android:clickable="true"
728x90
반응형