반응형
무하지
무하지
무하지
전체 방문자
오늘
어제
  • 분류 전체보기
    • 알고리즘
      • 알고리즘+자료구조
      • 문제풀이
    • Python
      • 머신러닝
    • 운영체제
    • Javascript
    • React
    • C#
    • C++
    • Java
    • Kotlin
    • 수학
      • 통계학
    • 기타
    • Computer Science

인기 글

최근 글

티스토리

hELLO · Designed By 정상우.
무하지

무하지

[안드로이드 스튜디오] Missing contentDescription attribute on image
Kotlin

[안드로이드 스튜디오] Missing contentDescription attribute on image

2021. 9. 13. 18:51
반응형
Missing contentDescription attribute on image

대강 이미지의 contentDescription 특성이 없으니까 추가해달라는 얘기다.

참조: https://support.google.com/accessibility/android/answer/7158690?hl=en

When using an ImageView, ImageButton, CheckBox, or other View that conveys information graphically, use an [android:contentDescription](<https://developer.android.com/reference/android/view/View.html#attr_android:contentDescription>) attribute to provide a content label for that View.

A content label sometimes depends on information only available at runtime, or the meaning of a View might change over time. For example, a Play button might change to a Pause button during music playback. In these cases, use [View#setContentDescription(CharSequence contentDescription)](<https://developer.android.com/reference/android/view/View.html#setContentDescription(java.lang.CharSequence)>) to update the content label at the appropriate time.

 

ImageView를 사용할 때 contentDescription을 설정하지 않으면 위와 같이 뜬다. 알트 쉬프트 엔터를 눌러서 추가해주자.

 

그러면 자동으로 TODO가 추가가 되면서 경고가 하나 더 튀어나온다. 이는 하드코딩 이슈이므로 strings.xml에 문자열을 추가해주면 된다.Missing contentDescription attribute on image

반응형

'Kotlin' 카테고리의 다른 글

[안드로이드 스튜디오] tablayout의 tabitem 사용시 java.lang.NullPointerException: Missing required view with ID  (0) 2021.09.14
[Android Studio] Hardcoded string "muyaho", should use '@string' resource  (0) 2021.09.13
[Kotlin] findViewById & kotlin-android-extensions & viewBinding  (0) 2021.09.13
[Kotlin] ConstraintLayout 동적으로 제어하기  (0) 2021.09.13
    'Kotlin' 카테고리의 다른 글
    • [안드로이드 스튜디오] tablayout의 tabitem 사용시 java.lang.NullPointerException: Missing required view with ID
    • [Android Studio] Hardcoded string "muyaho", should use '@string' resource
    • [Kotlin] findViewById & kotlin-android-extensions & viewBinding
    • [Kotlin] ConstraintLayout 동적으로 제어하기
    무하지
    무하지

    티스토리툴바