ActionBar过时问题

XML报错,什么都没动的时候就这样:android

Rendering Problems The following classes could not be found: 
android.support.v7.internal.app.WindowDecorActionBar 
(Fix Build Path, Create Class)    
Tip: Try to build the project.

在stackoverflow上找到解决办法: #####原文连接:找不到ActionBar

  • 方法1:
The Actionbar has been deprecated and replaced by Toolbar. That being said, you can do the following if you want to continue using Actionbar for now:    
   1.Open styles.xml in the values folder inside the res folder.
   2.Add the word Base to the beginning of the theme name so that it reads "Base.Theme.AppCompat.Light.DarkActionBar"
    I had the same issue today and this solution worked for me. FYI I am in Android Studio though, but hopefully the solution is similar for Eclipse.
   FYI here is a decent blog post on replacing the Actionbar with the Toolbar for when you are ready to do so: ...

翻一下意思就是ActionBar过时了,已经被ToolBar给取代了,在高版本中想用ActionBar须要:
1.打开styles.xml
2.BaseTheme也就是AppTheme改为"Base.Theme.AppCompat.Light.DarkActionBar"
#####关于ToolBar欢迎阅读:ToolBar的进阶阅读(英文的)

  • 方法2:
I think you must be depending on "com.android.support:appcompat-v7:23.1.1" in your module settings.
    ActionBar has been deprecated.
Just change your dependencies from 'com.android.support:appcompat-v7:23.1.1' to 'com.android.support:appcompat-v7:23.0.1' in "build.gradle".
    You can also change your style parent to "Theme.AppCompat.Light.NoActionBar".
    Try to use the Toolbar instead of ActionBar.

大体翻译:如今的v7包依赖的ActionBar过时了,在"build.gradle"将依赖的版本改低点'com.android.support:appcompat-v7:23.1.1'-->'com.android.support:appcompat-v7:23.0.1'.
或者说将style改为"Theme.AppCompat.Light.NoActionBar"
推荐各位尝试去使用ToolBar替代ActionBarapp

相关文章
相关标签/搜索