简体   繁体   English

Android Studio 1.4.1渲染问题

[英]Android Studio 1.4.1 rendering problems

I use Android Studio 1.4.1 and every time when I create a new project I have a rendering problem "Missing styles. is the correct theme chosen for this layout". 我使用Android Studio 1.4.1,每次创建新项目时,都会出现渲染问题“缺少样式。是为此布局选择的正确主题”。 I have tried to choose different API but the problem remains. 我尝试选择其他API,但问题仍然存在。

Also attache the screenshot of error rendering problem 还要附上错误渲染问题的屏幕截图

Can anyone help me to fix this problem? 谁能帮我解决这个问题? Thanks. 谢谢。

Android Studio is often brain-dead when it comes to matching up with the Android SDK installed. 在与已安装的Android SDK相匹配时,Android Studio经常让人脑筋急转弯。 It generates code and app styles that assume a particular SDK release that might not be installed. 它生成的代码和应用程​​序样式假定可能未安装特定的SDK版本。 The latest version of Android Studio always assumes you have the latest SDKs.. 最新版本的Android Studio始终假定您具有最新的SDK。

Open up Android SDK Manager (from the menu: Tools->Android->Sdk Manager ) and get the latest SDKs, platform, and build tools. 打开Android SDK Manager(从菜单: Tools->Android->Sdk Manager )并获取最新的SDK,平台和构建工具。 Then restart Android Studio and create a new project. 然后重新启动Android Studio并创建一个新项目。 Then make sure Android Studio is configured to use the latest for your tools for your new project. 然后,确保将Android Studio配置为对新项目使用最新的工具。 (File->Project Structure) (文件->项目结构)

And if that doesn't work, then blow off the whole thing. 如果那行不通,那么就把整个事情吹灭。 I had to do this a lot when I migrated from Eclipse to Android Studio. 从Eclipse迁移到Android Studio时,我不得不做很多事情。

  1. Uninstall Android Studio and Android SDK 卸载Android Studio和Android SDK
  2. Delete the directories from which they were installed. 删除安装它们的目录。
  3. Delete the .gradle, .android, and .AndroidStudio1.4 directories from your home directory (or c:\\users\\yourname directory). 从主目录(或c:\\ users \\ yourname目录)中删除.gradle,.android和.AndroidStudio1.4目录。
  4. Download latest Android Studio and re-install. 下载最新的Android Studio并重新安装。 Don't import any settings. 不要导入任何设置。
  5. First run of Android Studio should force it to update any missing SDK dependencies. 首次运行Android Studio时,应强制其更新所有缺少的SDK依赖项。
  6. Create new project. 创建新项目。 You should be good to go. 你应该很好。

first go to styles and and paste the below code to all the style files 首先转到样式,然后将以下代码粘贴到所有样式文件中

<!--
    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>

or 要么

<!--
    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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM