java–appcompat_v7和android-support-v7-appcompat之间的区别?

java–appcompat_v7和android-support-v7-appcompat之间的区别?,第1张

概述人们说他们是相同的,但他们在developersite所说的不同情况下使用1–添加没有资源的库ToaddaSupportLibrarywithoutresourcestoyourapplicationproject:MakesureyouhavedownloadedtheAndroidSupportLibraryusingtheSDKManager.Createalibs/direc

人们说他们是相同的,但他们在developer site所说的不同情况下使用

1 – 添加没有资源的库

To add a Support library without resources to your application project:Make sure you have downloaded the AndroID Support library using the SDK Manager.Create a libs/ directory in the root of your application project.copy the JAR file from your AndroID SDK installation directory (e.g., <sdk>/extras/androID/support/v4/androID-support-v4.jar) into your application's project libs/ directory.

2 – 使用资源添加库

To add a Support library with resources (such as v7 appcompat for action bar) to your application project: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 library project folder 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.You Now have a library project for your selected Support library that you can use with one or more application projects.

什么时候应该使用appcompat_v7(自动生成项目)
什么时候使用androID-support-v7-appcompat?

在这种情况下,程序员需要在项目中添加资源库吗?

请用我的经验喂我

解决方法:

androID-support-v7-appcompat.jar是一个JAR文件,只包含已编译的java类. appcompat_v7是一个库项目,它包含以前的JAR文件,没有实际的源代码,以及许多资源(布局,图像和& c).

在appcompat-v7的特定情况下,您需要使用library Project,因为它包含必要的UI资源.

其他库(例如v7 MediaRouter或v7 Palette)不包含这些资源,因此可以直接使用JAR文件.

请注意,差异主要适用于Eclipse(其中包含资源的库必须作为项目导入,而其他库只能放在libs文件夹中).使用AndroID Studio / gradle,这全部由构建系统处理,因此两者的过程相同.这在Support Library Setup文档中得到了很好的解释.

总结

以上是内存溢出为你收集整理的java – appcompat_v7和android-support-v7-appcompat之间区别?全部内容,希望文章能够帮你解决java – appcompat_v7和android-support-v7-appcompat之间的区别?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1118030.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存