1

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

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

使用 Android 4.2 它可以工作。

我已经在我的清单中设置了这个:

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>

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

4

1 回答 1

1

虽然您的主题看起来正确(尽管大多数人更喜欢使用Theme.AppCompat.Light.DarkActionBar平台独立性和所有设备的一致外观),但根据添加操作栏指南,您还必须确保您的活动扩展ActionBarActivity,而不是ActivityFragmentActivity

于 2013-09-17T17:16:41.567 回答