728x90
반응형

Tablayout의 Tabitem ID를 지정하는 경우 위와 같은 오류가 뜬다.
Material Tab에서 사용할 때 발생하는 버그로 tabItem의 ID를 삭제해주면 해결된다.
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.tabs.TabItem
android:id="@+id/tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
ID를 사용해서 tablayout에 접근하지 못하므로 tablayout의 api를 사용해야 한다.
val tablayout = binding.tabLayout
tabLayout.getTabAt(0)!!.text = "First Tab"
참조: https://github.com/material-components/material-components-android/issues/1162
구독과 공감은 블로그 운영에 큰 힘이 됩니다! ♡
긍정적인 댓글 남겨주시면 감사드리며,
보완해야 할 점이 있으면 댓글로 남겨주셔도 좋습니다!
728x90
반응형
'Android > TroubleShooting' 카테고리의 다른 글
[Android] Failed to find GeneratedAppGlideModule (0) | 2025.02.10 |
---|---|
[Android] 비어 있는 레이아웃을 클릭해도 클릭되지 않는 문제 (0) | 2025.02.06 |
[Android] RecyclerView Adapter 명명 조심하기 (2) | 2025.02.04 |
[Android] Activity에서 transaction된 Fragment에 접근하기 위해 사용한 findFragmentById()가 null을 리턴하는 이유 (1) | 2025.02.03 |
[Android] org.jetbrains.kotlin.gradle.tasks.CompilationErrorException (2) | 2024.11.24 |