1

我如何在我的应用程序中使用 holoeverywhere?

将库添加到我的项目时出现以下错误,指南如下:

导入 HoloEverywhere 时出错

`[2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__styles.xml:214: error: Error: No resource found that matches the given name: attr 'android:spinnerMode'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:63: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Spinner'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:65: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.Spinner'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:68: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ListView.DropDown'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:70: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ListView.DropDown'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:73: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.PopupWindow'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.PopupWindow'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__styles.xml:258: error: Error: No resource found that matches the given name: attr 'android:animationResolution'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:78: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ProgressBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:80: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ProgressBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ProgressBar.Horizontal'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:85: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ProgressBar.Horizontal'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:88: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.AutoCompleteTextView'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:90: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.AutoCompleteTextView'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__styles.xml:328: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:93: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Menu'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:96: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Title'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:98: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Title.Inverse'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:100: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:102: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:104: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Title'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:106: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Title.Inverse'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:108: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Subtitle'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:110: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:113: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:115: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Large'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:117: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Large'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:119: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Small'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__styles.xml:121: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Small'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v11\abs__themes.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v11\abs__themes.xml:6: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v11\abs__themes.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v11\abs__themes.xml:10: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:14: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:22: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:26: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:196: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:197: error: Error: No resource found that matches the given name: attr 'android:windowActionModeOverlay'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:198: error: Error: No resource found that matches the given name: attr 'android:windowCloseOnTouchOutside'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:30: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Dialog'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:222: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:223: error: Error: No resource found that matches the given name: attr 'android:windowActionModeOverlay'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values\abs__themes.xml:224: error: Error: No resource found that matches the given name: attr 'android:windowCloseOnTouchOutside'.
 [2012-12-05 20:23:11 - com.sditya.quadratic.equation.Quadratic] C:\Users\aditya\workspace\ActionBarSherlock\library\res\values-v14\abs__themes.xml:32: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.Dialog'.`

或者告诉我是否有另一种简单的方法可以将 Holo 深色主题添加到在 2.3.6 上运行的应用程序

4

2 回答 2

4

如果你还没有解决你的问题,我已经找到了解决方案。我已经在 HoloEverywhere 提供的 DemoActivity 应用程序上完成了它,但我认为在你的应用程序中使用它也不会有问题。

最重要的是导入所有库项目,顺序不重要:

  • 库文件夹中的 HoloEverywhere 库
  • 滑动菜单文件夹中的滑动菜单
  • 来自 contrib/ActionBarSherlock 库的 ActionBarSherlock 库

首先关闭所有不相关的项目,因为它们的错误/警告将从问题控制台中消失,因此更容易找到连接到 HoloEverywhere 的项目。

之后,请确保您在所有清单文件中都有

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" />

您甚至可以将 16 更改为 17,因为它是最新的 SDK。这条线的最短解释意味着,这个应用程序可以在任何具有高于 7 和低于 16 的 SDK 的 Android 设备上运行。

然后,对于所有添加的库,将项目构建目标更改为尽可能高(我放了 4.2)。我认为至少它必须是 SDK14 (4.0)。您将看到目标已更改,因为在项目树中您将拥有包含正确 android 目标库的文件夹。我必须警告您,更改此文件夹可能需要一两分钟 - 请继续关注进度条。

如何更改项目构建目标:

项目名称上的鼠标右键 -> 属性 [在列表的几乎底部](或当项目名称在菜单栏项目 -> 属性上突出显示时)在打开的窗口左面板 -> Android -> 右面板中选择正确的目标。然后应用并确定。

最后一件事是清理每个项目(同样可能需要一段时间,特别是如果你有,因为我有自动构建选项):菜单栏->项目->清理->选择与此相关的所有项目(如果你关闭了所有没有相关的,而不是您应该只看到此应用程序的项目),然后确定。

多亏了这一点,您将使用更高版本的 SDK 中添加的内容重建您的 R 文件,因此您可以在代码中引用它们。

现在你不应该有更多的错误,只有警告。

如果您仍然有一些问题,请在下面评论,也许我可以帮助您。

为了表明它在那里工作,您可以从运行 Android 2.3.4 的实际设备上截取屏幕截图

2.3.4 HoloEverywhere DemoActivity 2.3.4 HoloEverywhere DemoActivity

如果这有帮助,或者是您问题的答案,请不要忘记正确标记。

于 2012-12-15T19:47:21.757 回答
-1
  1. 从您的工作区中删除所有项目;
  2. 导入 ActionBarSherlock;
  3. 导入 HoloEverywhere;
  4. 导入您的项目;
  5. 确保 HoloEverywhere 引用 ActionBarSherlock 而你的引用 HoloEverywhere(你可以通过访问项目属性-> Android -> Library -> Add来做到这一点);
  6. 禁用项目->自动构建
  7. 清理所有项目(记得取消勾选立即开始构建);
  8. 右键单击 ActionBarSherlock 项目,然后单击Build project
  9. 分别对 HoloEverywhere 和您的 HoloEverywhere 执行相同操作。

您必须根据它们的依赖顺序分别构建每个项目。

于 2012-12-05T15:08:41.457 回答