本文介绍了如何在Android Studio的协调器布局中添加包含布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我创建了两个Xml活动.一种是用于活动界面布局,另一种是用于协调器布局.我将界面布局活动的包含布局添加到协调器布局中,但无法从预览中看到我的界面布局.
previeW为空白,这是它们向我显示的错误

******************************************************

错误1:渲染问题

< item>标签需要定义可绘制内容的可绘制"属性或子标签
_______________________________________________________________________________

错误2:无法通过相对布局制作装饰工具栏

java.lang.IllegalStateException:无法使用RelativeLayout制作装饰工具栏
在android.support.v7.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:549)
在android.support.v7.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:538)
在android.support.v7.widget.ActionBarOverlayLayout.onMeasure_Original(ActionBarOverlayLayout.java:339)
在android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java)
在android.view.View.measure_Original(View.java:22071)
在android.view.View_Delegate.measure(View_Delegate.java:80)
在android.view.View.measure(View.java:22035)
在android.widget.RelativeLayout.measureChildHorizo​​ntal(RelativeLayout.java:715)
在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
在android.view.View.measure_Original(View.java:22071)
在android.view.View_Delegate.measure(View_Delegate.java:80)
在android.view.View.measure(View.java:22035)
在com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:590)
在com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:343)
在com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384)
在com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
在com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:544)
在com.android.tools.idea.rendering.RenderTask.lambda $ inflate $ 3(RenderTask.java:678)
在java.util.concurrent.FutureTask.run(FutureTask.java:266)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)
在java.lang.Thread.run(Thread.java:745)

我尝试过的事情:

我尝试将主题更改为appCompact

hello

i created two Xml activities. One is for the activity interface layout and another one is the for the coordinator layout.I added the include layout for the interface layout activity into the coordinator layout and i cant see my interface layout from the preview.
the previeW is blank and these are the errors they are showing me

*************************************************

Error 1: RENDER PROBLEMS

<item> tag requires a ''drawable'' attribute or child tag defining a drawable
_______________________________________________________________________________

Error 2: can''t make a decor toolbar out of relative layout

java.lang.IllegalStateException: Can''t make a decor toolbar out of RelativeLayout
at android.support.v7.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:549)
at android.support.v7.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:538)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure_Original(ActionBarOverlayLayout.java:339)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java)
at android.view.View.measure_Original(View.java:22071)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:22035)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure_Original(View.java:22071)
at android.view.View_Delegate.measure(View_Delegate.java:80)
at android.view.View.measure(View.java:22035)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:590)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:343)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:544)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:678)
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)

What I have tried:

I have tried to change the theme to appCompact

推荐答案




这篇关于如何在Android Studio的协调器布局中添加包含布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 13:20