Kotlin - BottomNavigation in item of RecyclerView- android.view.InflateException: Binary XML file line #91:...
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rita.mpds, PID: 8331
android.view.InflateException: Binary XML file line #91: Binary XML file line #91: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:17)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:15)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1609)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:683)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:605)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23279)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23279)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2226)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:566)
at android.view.View.measure(View.java:23279)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:733)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:95)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1556)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:803)
at android.view.View.measure(View.java:23279)
E/AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
at android.view.View.measure(View.java:23279)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114)
... 83 more
This is the error that AS gave me, and I know this type a answer has been answered many times before but... I think we got a different problem now. I've checked all the sizes of the items that BottomNavigation has, and here it go one exemple of it:
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0,0 1,14 4A2,2 0,0 1,12 6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z"/>
So, the BottomNavigation is part of the item of the RecyclerView, and when I comment it the app run, thus... maybe the problem is here:
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#c2766f"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/pageIndicatorView"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu_cdu"/>
The menu:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/localizacao_barra_cartao"
android:orderInCategory="1"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Localização">
</item>
<item
android:id="@+id/relatorio_barra_cartao"
android:orderInCategory="2"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Relatório">
</item>
<item
android:id="@+id/sopiniao_barra_cartao"
android:orderInCategory="3"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="2ª Opinião">
</item>
<item
android:id="@+id/nova_foto_barra_cartao"
android:orderInCategory="4"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
tools:ignore="MenuTitle"
android:visible="true"
android:title="Nova foto">
</item>
</menu>
android android-recyclerview kotlin drawable bottomnavigationview
add a comment |
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rita.mpds, PID: 8331
android.view.InflateException: Binary XML file line #91: Binary XML file line #91: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:17)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:15)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1609)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:683)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:605)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23279)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23279)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2226)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:566)
at android.view.View.measure(View.java:23279)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:733)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:95)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1556)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:803)
at android.view.View.measure(View.java:23279)
E/AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
at android.view.View.measure(View.java:23279)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114)
... 83 more
This is the error that AS gave me, and I know this type a answer has been answered many times before but... I think we got a different problem now. I've checked all the sizes of the items that BottomNavigation has, and here it go one exemple of it:
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0,0 1,14 4A2,2 0,0 1,12 6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z"/>
So, the BottomNavigation is part of the item of the RecyclerView, and when I comment it the app run, thus... maybe the problem is here:
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#c2766f"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/pageIndicatorView"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu_cdu"/>
The menu:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/localizacao_barra_cartao"
android:orderInCategory="1"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Localização">
</item>
<item
android:id="@+id/relatorio_barra_cartao"
android:orderInCategory="2"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Relatório">
</item>
<item
android:id="@+id/sopiniao_barra_cartao"
android:orderInCategory="3"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="2ª Opinião">
</item>
<item
android:id="@+id/nova_foto_barra_cartao"
android:orderInCategory="4"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
tools:ignore="MenuTitle"
android:visible="true"
android:title="Nova foto">
</item>
</menu>
android android-recyclerview kotlin drawable bottomnavigationview
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
1
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01
add a comment |
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rita.mpds, PID: 8331
android.view.InflateException: Binary XML file line #91: Binary XML file line #91: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:17)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:15)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1609)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:683)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:605)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23279)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23279)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2226)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:566)
at android.view.View.measure(View.java:23279)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:733)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:95)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1556)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:803)
at android.view.View.measure(View.java:23279)
E/AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
at android.view.View.measure(View.java:23279)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114)
... 83 more
This is the error that AS gave me, and I know this type a answer has been answered many times before but... I think we got a different problem now. I've checked all the sizes of the items that BottomNavigation has, and here it go one exemple of it:
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0,0 1,14 4A2,2 0,0 1,12 6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z"/>
So, the BottomNavigation is part of the item of the RecyclerView, and when I comment it the app run, thus... maybe the problem is here:
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#c2766f"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/pageIndicatorView"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu_cdu"/>
The menu:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/localizacao_barra_cartao"
android:orderInCategory="1"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Localização">
</item>
<item
android:id="@+id/relatorio_barra_cartao"
android:orderInCategory="2"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Relatório">
</item>
<item
android:id="@+id/sopiniao_barra_cartao"
android:orderInCategory="3"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="2ª Opinião">
</item>
<item
android:id="@+id/nova_foto_barra_cartao"
android:orderInCategory="4"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
tools:ignore="MenuTitle"
android:visible="true"
android:title="Nova foto">
</item>
</menu>
android android-recyclerview kotlin drawable bottomnavigationview
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rita.mpds, PID: 8331
android.view.InflateException: Binary XML file line #91: Binary XML file line #91: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #91: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at android.view.LayoutInflater.createView(LayoutInflater.java:647)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:17)
at com.example.rita.mpds.Auxiliares.CartaoTipologiaAdapter.onCreateViewHolder(CartaoTipologiaAdapter.kt:15)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6794)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5975)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1609)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:683)
at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:605)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3336)
at android.view.View.measure(View.java:23279)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:23279)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2226)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.widget.ScrollView.onMeasure(ScrollView.java:566)
at android.view.View.measure(View.java:23279)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1502)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:556)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1638)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:733)
at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:95)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1556)
at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:803)
at android.view.View.measure(View.java:23279)
E/AndroidRuntime: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:401)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:23279)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:898)
at android.view.View.measure(View.java:23279)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2873)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2221)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1779)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7810)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at android.support.design.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at android.support.design.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at android.support.design.internal.ThemeEnforcement.checkCompatibleTheme(ThemeEnforcement.java:131)
at android.support.design.internal.ThemeEnforcement.obtainTintedStyledAttributes(ThemeEnforcement.java:110)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:138)
at android.support.design.widget.BottomNavigationView.<init>(BottomNavigationView.java:114)
... 83 more
This is the error that AS gave me, and I know this type a answer has been answered many times before but... I think we got a different problem now. I've checked all the sizes of the items that BottomNavigation has, and here it go one exemple of it:
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M21,9H15V22H13V16H11V22H9V9H3V7H21M12,2A2,2 0,0 1,14 4A2,2 0,0 1,12 6C10.89,6 10,5.1 10,4C10,2.89 10.89,2 12,2Z"/>
So, the BottomNavigation is part of the item of the RecyclerView, and when I comment it the app run, thus... maybe the problem is here:
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#c2766f"
app:itemIconTint="@color/white"
app:itemTextColor="@color/white"
app:layout_constraintTop_toBottomOf="@id/pageIndicatorView"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu_cdu"/>
The menu:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<item
android:id="@+id/localizacao_barra_cartao"
android:orderInCategory="1"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Localização">
</item>
<item
android:id="@+id/relatorio_barra_cartao"
android:orderInCategory="2"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="Relatório">
</item>
<item
android:id="@+id/sopiniao_barra_cartao"
android:orderInCategory="3"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
android:title="2ª Opinião">
</item>
<item
android:id="@+id/nova_foto_barra_cartao"
android:orderInCategory="4"
android:icon="@drawable/ic_chart"
app:showAsAction="always|collapseActionView"
tools:ignore="MenuTitle"
android:visible="true"
android:title="Nova foto">
</item>
</menu>
android android-recyclerview kotlin drawable bottomnavigationview
android android-recyclerview kotlin drawable bottomnavigationview
edited Nov 21 '18 at 12:56
asked Nov 21 '18 at 12:48
Pedro Relvas
558
558
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
1
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01
add a comment |
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
1
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
1
1
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01
add a comment |
1 Answer
1
active
oldest
votes
Thank you @TheWanderer, for the right answer!
I just added the android:theme="@style/Base.Theme.AppCompat
to my BottomNavigationView
in XML. It works!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412393%2fkotlin-bottomnavigation-in-item-of-recyclerview-android-view-inflateexception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thank you @TheWanderer, for the right answer!
I just added the android:theme="@style/Base.Theme.AppCompat
to my BottomNavigationView
in XML. It works!
add a comment |
Thank you @TheWanderer, for the right answer!
I just added the android:theme="@style/Base.Theme.AppCompat
to my BottomNavigationView
in XML. It works!
add a comment |
Thank you @TheWanderer, for the right answer!
I just added the android:theme="@style/Base.Theme.AppCompat
to my BottomNavigationView
in XML. It works!
Thank you @TheWanderer, for the right answer!
I just added the android:theme="@style/Base.Theme.AppCompat
to my BottomNavigationView
in XML. It works!
answered Nov 21 '18 at 14:55
Pedro Relvas
558
558
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412393%2fkotlin-bottomnavigation-in-item-of-recyclerview-android-view-inflateexception%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
We need to whole stacktrace.
– TheWanderer
Nov 21 '18 at 12:52
@TheWanderer it's on :)
– Pedro Relvas
Nov 21 '18 at 12:57
Do you have the dependency in gradle? developer.android.com/topic/libraries/support-library/…
– Ankhwatcher
Nov 21 '18 at 13:01
1
The style on this component requires your app theme to be Theme.AppCompat (or a descendant)
– TheWanderer
Nov 21 '18 at 13:01