Android2023. 9. 16. 21:06
 <com.google.android.material.tabs.TabLayout
         android:layout_height="wrap_content"
         android:layout_width="match_parent">

     <com.google.android.material.tabs.TabItem
             android:text="@string/tab_text"
             android:id="@+id/tabs1"
/>

     <com.google.android.material.tabs.TabItem
             android:icon="@drawable/ic_android"
             android:id="@+id/tabs2"
/>

 </com.google.android.material.tabs.TabLayout>

 

 

 

이런식으로 tablayout을 사용할때..

tablayout 사용시 요런 오류가 뜰때가 있는데..

 

 

 

java.lang.NullPointerException: Missing required view with ID

 

 

 

이것은 material 라이브러리를 사용할때 나오는 자체의 버그란다.

Tabitem의 id attr을 제거해주면 된다.

어차피..자바에서 getTabAt(0) 등으로 선택이 가능하니..

나는 무슨 문제인가 한참 고민했는데..자체 버그라니..ㅠ

Posted by 사슴영혼'-'