Android Studio 1.4渲染新抽屉模板中的问题

Android Studio 1.4渲染新抽屉模板中的问题,第1张

概述我刚刚更新到AndroidStudio1.4.我创建了一个新项目,目标SDK设置为Marshmellow.当我创建一个新的导航抽屉活动时,我可以在虚拟设备上运行该活动.但是,预览窗格中不会显示任何XML布局.以下是错误:activity_main.xml中:RenderingProblemsMissingstyles.Isthecorrecttheme

我刚刚更新到Android Studio 1.4.我创建了一个新项目,目标SDK设置为Marshmellow.当我创建一个新的导航抽屉活动时,我可以在虚拟设备上运行该活动.但是,预览窗格中不会显示任何XML布局.

以下是错误:
activity_main.xml中:

Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the theme combo Box above the layout to choose a different layout, or fix the theme style references. NOTE: One or more layouts are missing the layout_wIDth or layout_height attributes. These are required in most layouts. Or: automatically add all missing attributes The following classes Could not be instantiated:
– androID.support.design.Widget.NavigationVIEw (Open Class, Show Exception, Clear Cache)
Tip: Use VIEw.isInEditMode() in your custom vIEws to skip code or show sample data when shown in the IDE Exception Details androID.content.res.Resources$NotFoundException: Could not find bool resource matching value 0x7F090006 (resolved name: abc_config_showMenuShortcutsWhenKeyboardPresent) in current configuration.   at androID.content.res.BrIDgeResources.throwException(BrIDgeResources.java:841)   at androID.content.res.BrIDgeResources.getBoolean(BrIDgeResources.java:610)   at androID.support.v7.internal.vIEw.menu.MenuBuilder.setShortcutsVisibleInner(MenuBuilder.java:790)   at androID.support.v7.internal.vIEw.menu.MenuBuilder.(MenuBuilder.java:227)   at androID.support.design.internal.NavigationMenu.(NavigationMenu.java:34)   at androID.support.design.Widget.NavigationVIEw.(NavigationVIEw.java:99)   at androID.support.design.Widget.NavigationVIEw.(NavigationVIEw.java:92)   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)   at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:704)   at androID.vIEw.LayoutInflater.rInflate_Original(LayoutInflater.java:835)   at androID.vIEw.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at androID.vIEw.LayoutInflater.rInflate(LayoutInflater.java:811)   at androID.vIEw.LayoutInflater.rInflateChildren(LayoutInflater.java:798)   at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:515)   at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:394) copy stack to clipboard Failed to find style ‘toolbarStyle’ in current theme (8 similar errors not shown)

app_bar_main.xml:

Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the theme combo Box above the layout to choose a different layout, or fix the theme style references. NOTE: One or more layouts are missing the layout_wIDth or layout_height attributes. These are required in most layouts. Or: automatically add all missing attributes Failed to find style ‘toolbarStyle’ in current theme (8 similar errors not shown)

content_main.xml:

Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the theme combo Box above the layout to choose a different layout, or fix the theme style references. NOTE: One or more layouts are missing the layout_wIDth or layout_height attributes. These are required in most layouts. Or: automatically add all missing attributes Failed to find style ‘toolbarStyle’ in current theme (8 similar errors not shown)

nav_header_main.xml:

Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the theme combo Box above the layout to choose a different layout, or fix the theme style references. Couldn’t resolve resource @style/themeOverlay.AppCompat.Dark (3 similar errors not shown) Failed to find style ‘textVIEwStyle’ in current theme (2 similar errors not shown)

由于它提到了缺少的样式,这里是我的styles.xml:

<resources><!-- Base application theme. --><style name="Apptheme" parent="theme.AppCompat.light.DarkActionbar">    <!-- Customize your theme here. -->    <item name="colorPrimary">@color/colorPrimary</item>    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>    <item name="colorAccent">@color/colorAccent</item></style><style name="Apptheme.NoActionbar">    <item name="windowActionbar">false</item>    <item name="windowNoTitle">true</item></style><style name="Apptheme.AppbarOverlay" parent="themeOverlay.AppCompat.Dark.Actionbar" /><style name="Apptheme.PopupOverlay" parent="themeOverlay.AppCompat.light" />

我是AndroID开发的新手,当默认模板像这样抛出错误时,它不是引入新框架的最佳方式:(

即使是出现问题的解释也会有所帮助.谢谢.

解决方法:

转到应用 – > res – >值 – > style.xml

然后在父级前添加“Base”一词.

例如,在添加关键字“Base”之前

父= “theme.AppCompat.light.DarkActionbar”

添加关键字后

父= “Base.theme.AppCompat.light.DarkActionbar”

有关更多信息,请参阅此YouTube视频https://youtu.be/Ox7TvRJR_Ds?t=57s

总结

以上是内存溢出为你收集整理的Android Studio 1.4渲染新抽屉模板中的问题全部内容,希望文章能够帮你解决Android Studio 1.4渲染新抽屉模板中的问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1118194.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存