如何使用android-support-V7包中ActionBar

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何使用android-support-V7包中ActionBar相关的知识,希望对你有一定的参考价值。

参考技术A   以前3.0以前的版本要使用ActionBar,必须使用国外大牛写的ActionBarSherlock这个开源项目。今年的Google/IO大会之后,Gooogle官方在android-support-v 7包中添加了ActionBar,开始让2.1以后的版本支持ActionBar,从此以后曾经最火的Android开源项目ActionBarSherlock可以退出历史舞台了。

  要是用V7包中ActionBar也很简单,但有一个需要主要的地方。有些人可能该开始仅仅是把android-support-v7-appcompat.jar导入项目中

  具体使用 步骤 (针对于Eclipse):

  Create a library project based on the support library code:

  Make sure you have downloaded the Android Support Library using the SDK Manager .
  Create a library project and ensure the required JAR files are included in the project's build path:
  Select File > Import .
  Select Existing Android Code Into Workspace and click Next .
  Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to <sdk>/extras/android/support/v7/appcompat/ .
  Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat .
  In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path . For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
  Right-click the project and select Build Path > Configure Build Path .
  In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
  Uncheck Android Dependencies .
  Click OK to complete the changes.本回答被提问者和网友采纳

以上是关于如何使用android-support-V7包中ActionBar的主要内容,如果未能解决你的问题,请参考以下文章

如何使用android-support-v7-appcompat

如何使用android-support-v7-appcompat

项目引入android-support-v7-appcompat遇到的问题,no resource found that matches the given name 'android:The

android-support-v7-appcompat 和 android-support-v4 之间的区别

android-support-v7-appcompat 小红叉叉 解决方案

在 android 中使用 android-support-v7-appcompat 库运行 PopupMenu 时出现 NoClassDefFoundError