【问题标题】:how to view ActionBarSherlock displayOptions changes in Eclipse?如何在 Eclipse 中查看 ActionBarSherlock displayOptions 的变化?
【发布时间】:2012-10-31 22:30:45
【问题描述】:

我刚开始ActionBarSherlock,我设置了自定义样式:

<style name="AppTheme.ActionBar" parent="@style/Theme.Sherlock.Light">
    <item name="actionBarStyle">@style/actionBarStyle</item>
    <item name="android:actionBarStyle">@style/actionBarStyle</item>
</style>

<style name="actionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar">
    <item name="android:background">@drawable/header_bar</item>
    <item name="background">@drawable/header_bar</item>
    <item name="android:displayOptions">showTitle</item>
    <item name="displayOptions">showTitle</item>
</style>

并将其应用于清单中的 Activity。

如果我在 Eclipse 的查看器中打开 Activity 的 XML 布局文件,我可以看到背景,但 displayOptions 不会更改查看器,而且我总是看到默认图标+徽标。

在模拟器中运行应用会按预期显示 ActionBar。

为什么会这样?是否可以在 Eclipse 的布局编辑器中看到实际结果?

【问题讨论】:

    标签: android android-actionbar actionbarsherlock android-xml


    【解决方案1】:

    我假设您的构建目标是 >API 级别 13,因此您在 Eclipse 中的 GUI 编辑器将向您显示默认的 ActionBar。 ActionBarSherlock 是第三方库。它不会改变 XML 编辑器的外观。简而言之:不,AFAIK 无法在 GUI 编辑器中看到实际的 ActionBarSherlock。如果您想查看它,您还必须设置默认 ActionBar 的样式(只是为了预览它)。

    要设置默认 ActionBar 的样式,您必须使用这些父样式:

    @android:style/Theme.Holo.Light(而不是@style/Theme.Sherlock.Light

    对于 ActionBar:

    @android:style/Widget.Holo.Light.ActionBar(而不是@style/Widget.Sherlock.Light.ActionBar

    【讨论】:

      猜你喜欢
      • 2013-03-01
      • 1970-01-01
      • 2012-01-12
      • 1970-01-01
      • 2013-01-10
      • 1970-01-01
      • 2011-08-05
      • 1970-01-01
      • 2012-04-20
      相关资源
      最近更新 更多