我使用的是Android Studio 1.4.1,每当我创建一个新项目时,我都会遇到渲染问题"缺少样式。是为这种布局选择的正确主题"。我试图选择不同的API,但问题仍然存在。
还附上错误的屏幕截图 rendering problem
任何人都可以帮我解决这个问题吗?感谢。
答案 0 :(得分:1)
在与安装的Android SDK匹配时,Android Studio通常已经死气沉沉。它生成代码和应用程序样式,假定可能未安装的特定SDK版本。最新版本的Android Studio始终假设您拥有最新的SDK ..
打开Android SDK Manager(从菜单中Tools->Android->Sdk Manager
)并获取最新的SDK,平台和构建工具。然后重新启动Android Studio并创建一个新项目。然后确保Android Studio配置为使用最新的工具为您的新项目。 (文件 - >项目结构)
如果这不起作用,那就吹掉整个事情吧。当我从Eclipse迁移到Android Studio时,我不得不这么做。
答案 1 :(得分:0)
首先转到样式并将以下代码粘贴到所有样式文件
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
或强>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>