New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tab Items] Tab Items does not work with View Binding, throws NPE #1162
Comments
Also an issue opened here https://issuetracker.google.com/issues/152606440 |
Still happening with |
same here. Noticed on com.google.android.material:material:1.2.1 Any work around? |
When will this bug be fixed? |
Still happening ... Nearly 1 year later. Someone has a workaround ? |
Still happening, I found a workaround, try this: Go to your XML and search the ID that is generating the issue and delete its android:id Use the TabLayout API in your class to access the TabItems. For example, this is my XML: <com.google.android.material.tabs.TabItem Go to your class: val tabView: TabLayout = binding.tbType //This is my tab layout |
I don't think this is something we plan on supporting since it would require a significant change in the way TabLayout manages each TabItem. If there's a way to override the view type given to a I would suggest sticking with @Dreft12's suggestion of using I'm going to close this for now, but feel free to re-open if there are thoughts/questions/suggestions. |
Description:
Filing this in response to ja...@google.com comment on https://issuetracker.google.com/issues/145687658
Expected behavior: Tab Items working with View Binding without throwing NPEs
Source code:
Required source files could be found at https://issuetracker.google.com/issues/145687658
Material Library version:
The text was updated successfully, but these errors were encountered: