Android - API 10 没有 ActionBar

标签 android android-actionbar android-actionbar-compat

我使用支持库中的 ActionBar 在 3.0 之前的设备上包含操作栏。

但问题是,没有显示操作栏(使用 API 10 - 在模拟器上)。

在 Android 4.2 上可以使用。

我在我的 list 中设置了这个:

android:theme="@style/Theme.Base.AppCompat.Light.DarkActionBar"

我的 styles.xml 看起来像这样:

<style name="AppBaseTheme" parent="Theme.Base.AppCompat.Light.DarkActionBar">
    <!--
        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>

所有功能都有效。但是没有操作栏。 :( 我认为这是一个 Style 问题,因为代码中没有异常。

最佳答案

虽然您的主题看起来正确(尽管大多数人更愿意使用 Theme.AppCompat.Light.DarkActionBar 以实现平台独立性和在所有设备上的一致外观),但根据 Adding an Action Bar guide您还必须确保您的 Activity 扩展 ActionBarActivity ,而不是 ActivityFragmentActivity

关于Android - API 10 没有 ActionBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18855790/

相关文章:

java - Android 中的音频录制示例项目

android - 异构开发环境

Android WebView-记住用户名和密码

android - 带有滑动操作栏的抽屉布局,如 facebook

android - ActionBarSherlock 和 Action Bar.On 导航监听器

android - 当 API 7 上有溢出操作时,菜单按钮会使应用程序崩溃

android - ActionBarActivity 和 ActivityUnitTest - NameNotFoundException

android - 最新 PlayServices 8.3 中的 GoogleSignInAccount 内部崩溃

android - Material 主题 Android Action Bar 样式生成器

android - 如何自定义Action Bar字幕字体?