使用动作条compability版本的Andr​​oid 4.0 [英] Use ActionBar compability version with Android 4.0

查看:96
本文介绍了使用动作条compability版本的Andr​​oid 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟着code在动作条compability版本

当我使用code的API级别10或小于它,它显示了一个动作条,但是当我使用它的API级别11或更高版本,它不显示标识图标和行动项目。

When I use the code for API level 10 or less than it, it shows a ActionBar, but when I use it for API level 11 or greater, It does not show logo icon and Action items.

我检查了班,我明白了:

I checked the classes and I understood:

ActionBarHelperBase:API等级10以下

ActionBarHelperBase : API level 10 or less.

ActionBarHelperHoneycomb:API级别11或更高。

ActionBarHelperHoneycomb : API level 11 or greater.

ActionBarHelperICS:API级别14或更高

ActionBarHelperICS : API level 14 or greater.

什么是固定的动作条的Andr​​oid版本3.0或更高版本的最好方法是什么?特别的Andr​​oid 4.0

What is the best way to fix the ActionBar for Android Version 3.0 or greater? Specially Android 4.0

推荐答案

这个问题是在清单文件。我应该删除机器人:主题=@风格/ Theme.ThemeCompabilityVersion 从清单文件

The problem was in the Manifest file. I should remove android:theme="@style/Theme.ThemeCompabilityVersion from the Manifest file.

然后,我需要检查的OnCreate在code版本()之类方法:

Then I need to check the version in the code in OnCreate() method like:

private void setTheme() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) 
        setTheme(R.style.ThemeCompabilityVersion);
    else 
        setTheme(R.style.AppTheme);         
}

这篇关于使用动作条compability版本的Andr​​oid 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆