如何确保一个支持库项目(如Android的支持-V7-appcompat)的资源(如样式),被添加到您的项目? [英] How do you ensure resources (e.g. styles) of a support library project (e.g. android-support-v7-appcompat), are added to your project?

查看:331
本文介绍了如何确保一个支持库项目(如Android的支持-V7-appcompat)的资源(如样式),被添加到您的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现的actionbarcompat支持库项目在我的Andr​​oid应用程序,我都遵循的指导原则的从如何实现这些,但支持库的资源Android网站这里仍然不向我的项目。 注:我能使用从库项目的已编译的类定义的方法,我只是不知道如何从样式引用。 我使用的Eclipse IDE。 任何人只要有一个想法如何或我在做什么错了,请帮助我。

解决方案

我忽然发现我自己的错!我实在知道一些其他人可能走同样的道路。

这些都增加了支持库与资源的步骤。

  1. 选择文件>导入。
  2. 选择现有的Andr​​oid code进入工作区,然后单击下一步。
  3. 浏览到SDK的安装目录,然后到支持库文件夹/演员/安卓/支持/ V7 / appcompat /.
  4. 单击Finish导入该项目。您现在应该看到一个新的项目名为Android的支持-V7-appcompat。
  5. 在新的库项目,展开库/文件夹,右键单击每个.jar文件,并选择构建路径>添加两个 Android的支持,v4.jar和Android支持-V7-appcompat.jar文件 构建路径。 6.Right单击该项目并选择构建路径>配置构建路径。 7.In订单和导出选项卡,选中刚刚添加到构建路径的.jar文件,因此它们可用于依赖于项目 这个库项目。该appcompat项目需要您导出 无论是Android的支持,v4.jar和Android支持-V7-appcompat.jar 文件。取消选中Android的依赖。 8.Click确定完成修改。

现在你的库项目添加到应用程序:

  1. 在项目资源管理器中,右键单击您的项目并选择属性。

  2. 在库窗格中,单击添加。

    • 在这里是我出了问题。检查您是否已经做了正确的方式太(如图所示)

<醇开始=3>
  • 选择库项目,然后单击确定。该appcompat项目应列为Android的支持-V7-appcompat。
  • 在属性窗口中,单击确定。
  • I am trying to implement the actionbarcompat support library project in my android application and I have followed the guidelines here from the android website on how to implement these but the resources of the support library still are not available to my project. Note: I am able to use methods defined from the compiled classes of the library project, I just don't know how to reference from the styles. I am using eclipse IDE. Anybody with an idea how or what I am doing wrong please assist me.

    解决方案

    I happen to have found my own mistake! Most certainly I know a few others might go the same path.

    These are the steps in adding a support library with resources.

    1. Select File > Import.
    2. Select Existing Android Code Into Workspace and click Next.
    3. Browse to the SDK installation directory and then to the Support Library folder /extras/android/support/v7/appcompat/.
    4. Click Finish to import the project. You should now see a new project titled android-support-v7-appcompat.
    5. In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path. 6.Right-click the project and select Build Path > Configure Build Path. 7.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. The appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files. Uncheck Android Dependencies. 8.Click OK to complete the changes.

    Now You add the library project to your application:

    1. In the Project Explorer, right-click your project and select Properties.

    2. In the Library pane, click Add.

      • here is where I went wrong. Check if you've done it the right way too (As shown)

    1. Select the library project and click OK. The appcompat project should be listed as android-support-v7-appcompat.
    2. In the properties window, click OK.

    这篇关于如何确保一个支持库项目(如Android的支持-V7-appcompat)的资源(如样式),被添加到您的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆