Sherlock ActionBar和滑动菜单

时间:2013-03-01 13:58:43

标签: android actionbarsherlock slidingmenu

在我的应用程序中,我只想使用滑动菜单,我应该使用的操作栏是Sherlock Action栏。

我下载了两个库。 Sliding Menu

1https://github.com/jfeinstein10/SlidingMenuSherlock Action bar

我可以单独使用这两个库。我需要在我的应用程序中一起使用。所以在搜索之后我发现我必须这样做

将ActionBarSherlock添加为SlidingMenu的依赖项 进入我计划使用的SlidingActivities,使它们延伸Sherlock__Activity而不是__Activity。

当我将SAB添加到Sliding菜单作为依赖时,我在eclipse中遇到这样的错误。

Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.
Versions found are:
Path: C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc        \JakeWharton-ActionBarSherlock-e5c2d1c\library\libs\android-support-v4.jar
Length: 271754
SHA-1: 53307dc2bd2b69fd5533458ee11885f55807de4b
Path: C:\Users\Kamalone\Downloads\SlidingMenu-master\SlidingMenu-master\library    \libs\android-support-v4.jar
Length: 385685
SHA-1: 48c94ae70fa65718b382098237806a5909bb096e

罐子不匹配!修复您的依赖项

那我该怎么做呢?

从sherlockAB中删除lib文件后,我收到了像这样的manuy错误

C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:6: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.Solid'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:12: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.Solid.Inverse'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:15: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabView'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:17: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabView'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabView.Inverse'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:22: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabBar'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabBar'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabBar.Inverse'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values\abs__styles.xml:101: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabText'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:31: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabText'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabText.Inverse'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values-v14\abs__styles.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionMode.Inverse'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\library\res\values\abs__styles.xml:328: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.
[2013-03-01 14:18:14 - SlidingMenuLibrary] C:\Users\Kamalone\Downloads\JakeWharton-ActionBarSherlock-4.2.0-0-g90939dc\JakeWharton-ActionBarSherlock-e5c2d1c\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'.

3 个答案:

答案 0 :(得分:5)

这里的第一个问题是他们使用不同版本的支持库(android-support-v4.jars)。

对于第二个问题,您必须使用其中一个Sherlock主题来运行项目。 ActionBarSherlock需要许多定义才能正确设置操作栏的样式。 因此它需要这些样式,你必须使用ABS主题。 当然,您可以使用自己的主题,但必须使用Sherlock的主题作为您的主题。有关详细信息,请参阅Sherlock主题指南。

将您的AndroidManifest.xml文件更改为使用Sherlock主题:

<application
   android:allowBackup="true"
   android:icon="@drawable/ic_launcher"
   android:label="@string/app_name"
   android:theme="@style/Theme.Sherlock.Light" >

   <!-- ... -->

</application>

答案 1 :(得分:2)

只丢掉2个android-support-v4.jars中的1个。两个库都包含它,因为它们需要它,但是当你将它们链接在一起时,它们也会自动使用彼此的.jars。

答案 2 :(得分:0)

删除SAB或SM中的android支持库,如果你只是在另一个项目中使用它们作为librarys,从SAB和SM中删除两个库,并在你的主项目中添加一个android支持库。图书馆将显示错误的红色x,但只是忽略它。你的应用应该正常编译。