因此该应用程序在Android 7.0中运行良好,但工具栏在android 4.4 kitkat中不可见。如果用户点击应该有汉堡包图标的空白区域,导航抽屉仍会打开,工具栏仍然存在。
渲染错误存在于活动xml文件中,其中包含错误指向的app_bar_layout xml文件。
这是XML呈现问题中的错误:
//Exception raised during rendering: Can't make a decor toolbar out of CoordinatorLayout
java.lang.IllegalStateException: Can't make a decor toolbar out of CoordinatorLayout
at android.support.v7.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:543)
at android.support.v7.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:532)
at android.support.v7.widget.ActionBarOverlayLayout.fitSystemWindows(ActionBarOverlayLayout.java:282)
at android.view.View.onApplyWindowInsets(View.java:7755)
at android.view.View.dispatchApplyWindowInsets(View.java:7809)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6435)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:6439)
at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1422)
at android.view.ViewRootImpl_Accessor.dispatchApplyInsets(ViewRootImpl_Accessor.java:24)
at com.android.layoutlib.bridge.impl.Layout.requestFitSystemWindows(Layout.java:315)
at android.view.View.requestFitSystemWindows(View.java:7945)
at android.view.View.requestFitSystemWindows(View.java:7945)
at android.view.View.requestFitSystemWindows(View.java:7945)
at android.view.View.requestFitSystemWindows(View.java:7945)
at android.view.View.requestApplyInsets(View.java:7953)
at android.support.v4.view.ViewCompatLollipop.requestApplyInsets(ViewCompatLollipop.java:49)
at android.support.v4.view.ViewCompat$LollipopViewCompatImpl.requestApplyInsets(ViewCompat.java:1630)
at android.support.v4.view.ViewCompat.requestApplyInsets(ViewCompat.java:2970)
at android.support.design.widget.CoordinatorLayout.onAttachedToWindow(CoordinatorLayout.java:246)
at android.view.View.dispatchAttachedToWindow(View.java:15395)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
我尝试将坐标布局更改为其他布局但不起作用。
答案 0 :(得分:0)
在包含工具栏的布局时,您可能拥有android:id
属性:
<include
android:id="@+id/toolbar_layout"
layout="@layout/toolbar" />
我刚删除了ID以获取此代码:
<include
layout="@layout/toolbar" />
然后我强制刷新布局。你能行的 here
它对我有用。