简体   繁体   English

Sherlock ActionBar和滑动菜单

[英]Sherlock ActionBar and Sliding menu

In my application i just want to use sliding menu and the Action bar which i should use is Sherlock Action bar. 在我的应用程序中,我只想使用滑动菜单,我应该使用的操作栏是Sherlock Action栏。

I downloaded both the libraries. 我下载了两个库。 Sliding Menu 滑动菜单

1 : https://github.com/jfeinstein10/SlidingMenu and Sherlock Action bar 1https//github.com/jfeinstein10/SlidingMenuSherlock Action栏

I am able to use both this libraries Separately. 我可以分别使用这两个库。 I need to use together in my application. 我需要在我的应用程序中一起使用。 So after searching i found that i have to do like this 因此,搜索后我发现我必须这样做

Add ActionBarSherlock as a dependency to SlidingMenu Go into the SlidingActivities that i plan on using make them extend Sherlock__Activity instead of __Activity. 将ActionBarSherlock添加为对SlidingMenu的依赖项进入我计划使用的SlidingActivities,使它们扩展Sherlock__Activity而不是__Activity。

While i am adding the SAB to Sliding menu as dependency i am getting error like this in eclipse. 虽然我将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

Jar mismatch! 罐子不匹配! Fix your dependencies 修复您的依赖项

So what should i do for this ?? 那我该怎么办?

After removing the lib file from the sherlockAB i am getting manuy errors like this 从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'.

The first problem here is that they're using different versions of the support lib (android-support-v4.jars). 这里的第一个问题是他们正在使用不同版本的支持库(android-support-v4.jars)。

For the second problem, you have to use one of the Sherlock themes to get your project to run. 对于第二个问题,您必须使用Sherlock主题之一来使项目运行。 ActionBarSherlock needs many definitions to get the action bar styled correctly. ActionBarSherlock需要许多定义才能正确设置样式。 Thus it needs these styles and you have to use the ABS themes. 因此,它需要这些样式,并且您必须使用ABS主题。 You can use your own theme, of course, but you must use one of Sherlock's themes as a base for yours. 当然,您可以使用自己的主题,但是必须使用Sherlock的主题之一作为基础。 See the Sherlock theming guide for more information on this. 有关详细信息,请参阅Sherlock主题指南。

Change your AndroidManifest.xml file to use a Sherlock theme: 更改AndroidManifest.xml文件以使用Sherlock主题:

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

   <!-- ... -->

</application>

Just throw out 1 of the 2 android-support-v4.jars. 只丢掉2个android-support-v4.jars中的1个。 Both libraries contain it cause they need it, but when you link the libraries together they automatically use each other's .jars too. 这两个库都包含它,因为它们需要它,但是当您将这些库链接在一起时,它们也会自动使用彼此的.jars。

remove on of the android support librarys in SAB or SM, if you just use both in another project as librarys, remove both librarys from SAB and SM and add an android support library to your main project. 如果仅在另一个项目中同时使用SAB或SM中的android支持库,请从SAB和SM中删除这两个库,然后将android支持库添加到主项目中。 The librarys will show a red x as in error but just ignore it. 图书馆将显示错误的红色x,但只是忽略它。 your app should compile normally. 您的应用应该可以正常编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM