gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:17:00 25 4
gpt4 key购买 nike

我刚刚更新到 Android Studio 1.4。我创建了一个目标 SDK 设置为 Marshmellow 的新项目。当我创建一个新的 Navigation Drawer Activity 时,我可以在虚拟设备上运行该 Activity 。但是,没有任何 XML 布局显示在预览 Pane 中。

以下是错误: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 开发的新手,当默认模板像这样向您抛出错误时,这不是引入新框架的最佳方式:(

即使解释出了什么问题也会有所帮助。谢谢。

最佳答案

我遇到了同样的问题,我认为最好的解决办法是点击“自动添加所有缺失的属性”链接。然后,一切都会正常工作。

关于Android Studio 1.4 新抽屉模板渲染问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32895224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com