zoukankan      html  css  js  c++  java
  • 解决Android Studio默认AppTheme 没有lable标签,不显示等问题

    之前百度了好多方法,都是治标不治本。

    加Base啊,

    修改主题啊什么的,

    都没有解决我实在需要解决的问题。

    下面的方法最终解决了我的问题。

    设计页面右上角有个红色圆圈,里面一个感叹号,点开它查看错误信息:

    The following classes could not be instantiated:
       - android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
       - android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
       - android.support.v7.app.WindowDecorActionBar (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.  

    If this is an unexpected error you can also try to build the project, then manually refresh the layout.  

    Exception Details

    java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener

    这是由于插件版本与SDK版本不符引起的,解决办法是打开Project-%工程名%-app-build.gradle,修改这几行:

    compileSdkVersion 28  改为compileSdkVersion 27
    targetSdkVersion 28   改为targetSdkVersion 27
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'改为

    implementation 'com.android.support:appcompat-v7:27.1.1'

    然后点击右上角的Sync Now进行同步

    同步完成,构建完成后回到设计界面,预览图可以正常显示。

    参考https://blog.csdn.net/weixin_42649678/article/details/81182356

  • 相关阅读:
    分类和预测
    机器学习&数据挖掘笔记_16(常见面试之机器学习算法思想简单梳理)
    字符串匹配的KMP算法
    灰度共生矩阵提取纹理特征源码
    redis永不过期,保留最新5条数据,StringUtils.join()等总结
    Session问题以及解决方案
    spring boot 配置 log4j2
    每日知识记载总结54
    spring cloud踩坑指南
    每日知识记载总结53
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/9671040.html
Copyright © 2011-2022 走看看