【发布时间】:2016-07-06 16:41:01
【问题描述】:
我使用的是 Android Studio 1.5.1,我的材料设计出现渲染错误。这是styles.xml 页面,没有材料编辑:
<!-- 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" />
这是带有材质编辑的代码。
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light">
<!-- 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" />
由于某种原因,它给出了
"注意:一个或多个布局缺少 layout_width 或 布局高度属性。这些在大多数布局中都是必需的。”等 预览。在我的 Nexus 6P 上运行也会出现同样的问题。我是 使用安卓 6.0.1。它也找不到“toolbarStyle”。我是一个 初学者,有谁能帮忙吗?
编辑:我的“自动添加缺少的属性”链接不起作用。
【问题讨论】:
-
也添加你的布局 xml
标签: android android-layout android-studio material-design