Android Support Library解释

2020-03-17 02:30 来源:未知

3. Design Support Library

它是Android官方用来便于开采者在动用中实现Android Material Design风格的UI而提供的辅助库,里面有为数不菲Android官方提供的Material Design风格的轮子。重要的车轱辘有:

  • AppBarLayout
  • BottomSheetDialogFragment
  • CollapsingToolbarLayout
  • CoordinatorLayout
  • FloatingActionButton
  • NavigationView
  • Snackbar
  • TabLayout
  • TextInputLayout
  • TextInputEditText

谷歌(Google卡塔尔国开拓者博客上还恐怕有二个录制,特意介绍了那么些库。

使用:

com.android.support:design:24.1.1

(3) support library的使用

3.1 请确定保证您下载了support library

android studio 中的界面

单独的SDK Manager界面

**3.2 增添步骤 **
在ADT中急需遵守以下步骤:
1、右击当前工程,查找Properties
2、选择Java Build Path
3、采取Libraries tab,点击右左侧板的Add External JA大切诺基s按键
4、采纳android-support-v4.jar文件,这一文本的大范围路径为:YOU奔驰G级_DRIVEandroid-sdksextrasandroidsupportv4android-support-v4.jar
5、完毕拉长后,接纳Order and Export标签,确认就能够。

在android studio中只须要在build.gradle中增多档期的顺序依赖:

  ... 
compile "com.android.support:support-v4:18.0. "
}

注意:
*1 support library提供了和framework 的API相符名字的一些类,可是类的任务在 android.support 下,大概有Compat 那样的后缀。由此利用support library的时候,请保管您导入了不错的support library

android.support.v7.widget.ToolBar

2 倘诺项目同期导入了v4 和v7 appcompat 包,请保管最徐熙娣女士(Elephant Dee卡塔尔国DK 版本是API level 7 ,实际不是API level 4。

1. 为什么要提供Support Library

最珍视的开始和结果正是:为了能在低版本的Android系统上接收高版本的SDK才有所的新职能、新特点。比方,Fragment,ActionBar、Material Design风格等。

谷歌把那个高版本SDK才干备的新特点打包进Support Library,当开辟者想利用这么些新特点,又须要相配老版本Android系统时,就能够引进Support Library。当然,那么些包裹进Support Library的新特色,全体都被完整的隐含在了风尚的Android SDK中。所以要是开荒者的App仅协理新型系统,也得以不引进Support Library。

Google为了使开垦者能够方便的引入Support Library,把它们做成了注重包的款式,通过Gradle能够很有益于的引进,举例:

compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.3.0'

除开最首要的来由,还应该有其余几点原因,能够参照Google官方文书档案对此的疏解。

UI控件类

  1. ViewPager:左右滑行切换的ViewGroup。
    Adds a ViewGroup that manages the layout for the child views, which the user can swipe between.
  2. PagerTitleStrip:ViewPager小圆点。
    Adds a non-interactive title strip, that can be added as a child of ViewPager.
  3. PagerTabStrip :页签。
    Adds a navigation widget for switching between paged views, that can also be used with ViewPager.
  4. DrawerLayout :侧边栏,拉出来。
    Adds support for creating a Navigation Drawer that can be pulled in from the edge of a window.
  5. SlidingPaneLayout
    Adds widget for creating linked summary and detail views that appropriately adapt to various screen sizes.

9. Custom Tabs Support Library

提供了一些API,用于加多和保管自定义tab。

使用:

com.android.support:customtabs:24.1.1

本博客原地址:http://www.jianshu.com/p/be4602e0d79f
前天新品类从零早前搭建android框架 真实项目费用(1)-开篇介绍和工程目录布局在时时刻刻的做到进程中,Material Design使用也正如宽泛,所以想写一篇关于Material Design 真实使用以致导入项目框架的例子。于是项目中会如下图所示的部分support library,翻了翻官方网址,有了那篇博客,全面领会android项目都在应用的support library。

合法表明:https://developer.android.com/topic/libraries/support-library/index.html
参考:
http://www.jianshu.com/p/a5aa5f209895

v13 Support Library

Support classes to access some of the android.app package features introduced after API level 13 in a backwards compatible fashion.

This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern with the (FragmentCompat) class and additional fragment support classes For more information about fragments, see the Fragments developer guide. For detailed information about the v13 Support Library APIs, see the android.support.v13 package in the API reference.

 compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.3.0'

(2) 多少个常用的support library

2.1 Android Support v4: 是最初(二零一一年一月份)完毕的库。用在Android1.6 (API lever 4卡塔尔(قطر‎只怕越来越高版本之上。它包蕴了针锋相投于别的support library 包更加的多的法力。扶植使用组件,客商分界面,数据管理,网络连接,编制程序工具类等。被大家领悟的有Fragment,ViewPager,PagerTabStrip,DrawerLayout
2.2 Android Support v7: 那一个包是为着思谋Android2.1(API level 7卡塔尔(قطر‎及以上版本而陈设的,不过v7是要依附v4那一个包的,约等于若是要使用,三个包得同期被引述。app-compat-v7扶植了Action Bar和AppCompatActivity,用于Material Design。v7还会有其它界分有友好特色的包,如图所示为有着v7包。详细情况请点击,Support Library 中的各样support 包(官方网址卡塔尔国

v7中的全数包

2.3 Design Support Library: Google IO 二零一四的Design Support Library的控件。增加Navigation Drawer,Floating Action Button,SnackBar等。那象征全体2.1上述的器材,供给扶持Material Design的局地控件和表现形式的需求后续于这几个库,并且能够完结相应的意义。
请参见那么些网站,Android Material Design 包容库的利用安详严整
2.4 Multidex Support Library: Android 使用android-support-multidex消除Dex超过方法数的界定难点.
2.5 其他:
v8 Support Library(支持renderScript);
v13 Support Library(平板开垦中用到);
v14 Preference Support Library(preference扩展);
v17 Preference Support Library for TV;
v17 Leanback Library(支持TV开发);
Annotations Support Library(annotation支持);
Custom Tabs Support Library(custom tab的支持);
Percent Support Library(支持 PercentFrameLayout 和PercentRelativeLayout);
App Recommendation Support Library for TV;

2.当下截至Android Support Library 包涵的信任性包介绍

name libraries
v4 Support Libraries v4 compat library;

v4 core-utils library;
v4 core-ui library;
v4 fragment library; |
| 2 | Multidex Support Library |
| 3 | v7 Support Libraries | v7 appcompat library
v7 cardview library
v7 gridlayout library
v7 mediarouter library
v7 palette library

| 4 |v8 Support Library| v8 renderscript library |
||

数量操作

  • Loader - Adds support for asynchronous loading of data. The library also provides concrete implementations of this class, including CursorLoader and AsyncTaskLoader.
  • FileProvider - Adds support for sharing of private files between applications.

在付出文档API Reference中包android.support.v4下得以看看v4库完整的类、接口等。
v4库文件坐落于sdk目录<sdk>/extras/android/support/v4/中,不包罗UI能源(增加带能源的安卓库)。
选拔v4库对应的Gradle信任指令:com.android.support:support-v4:18.0.

Google官方开采者网址有一篇小说特地解释了这一有滋有味Support Library,互连网上的许多篇章都翻译自它。小说地址在这里处。下边是自己要好的一对总计。

(1) 为何会有匡助库(support library)?

要是在低版本Android平台上开采多个应用程序,而应用程序又想接收高版本能力备的效力,就要求使用Support库, 每四个support library 向上宽容于不一致的API版本。注意运用是在 Android 1.6(API level 4)以上。

support library

3.导入信任包

Android Support 重视包的本子要和compileSdkVersion 22版本号大概一致。
android 信赖包的逐条历史版本 Support Library Revision History
Dependencies --> Library Dependence

v7 appcompat library兼容库

This library adds support for the Action Bar user interface design pattern.
为早前系统提供新版UI设计观念建议的Action Bar的匡助,它借助v4库。

下边列举v7包容库的重要性API:

  • ActionBar - Provides an implementation of the action bar user interface pattern. For more information on using the Action Bar, see the Action Bar developer guide.
  • ActionBarActivity - Adds an application activity class that must be used as a base class for activities that uses the Support Library action bar implementation.
  • ShareActionProvider - Adds support for a standardized sharing action (such as email or posting to social applications) that can be included in an action bar.

10. Percent Support Library

增加了百分比搭架子控件,如PercentFrameLayout,PercentRelativeLayout。

使用:

com.android.support:percent:24.1.1

(4) 参谋链接

Support Library 大概浏览和版本更新(官方网站)
Support Library 中的各个support 包(官方网站卡塔尔
Support Library 的使用(官网)
UNDERSTANDING THE ANDROID SUPPORT LIBRARY
Android Material Design 包容库的选取详细明白

grammar_cjkRuby: true

DATE: 2016-5-13.

13. App Recommendation Support Library for TV

在电视平台上,增添了用于做内容引进的一多元API。

使用:

com.android.support:recommendation:24.1.1

  1. Support Library Features
  2. android design support library
  3. Material design
  4. 面向开拓者的材质设计
  5. Android Support Library介绍
  6. Android Support宽容包详细明白

花色中充裕的support library

Android开拓文书档案

  • Develop > Tools > Support Library.

2. v7 Support Libraries

支撑Android 2.1(API level 7)及以上。由一密密层层独立的v7包组成,能够分级引入。

依赖v4 Support Library。今后在Android Studio中新建叁个工程,暗中同意就能够引进那些library。而它又依据v4 Support Library,所以v4 Support Library也会被默许引进工程。那么些库重视的法力正是提供对Action Bar的帮助。

使用:

 compile 'com.android.support:appcompat-v7:24.1.1'

提供了CardView控件,一种Material Design风格的卡牌形控件。

使用:

com.android.support:cardview-v7:24.1.1

提供了GridLayout类,一种网格构造控件,与LinearLayout,RelativeLayout同级。

使用:

com.android.support:gridlayout-v7:24.1.1

法定文书档案的批注是:用来调整多媒体流的分发。不过实际上中基本超级少用到,风乐趣的能够参照官方文档。

提供了Palete类,能够从一张图片中领到出它的主色调。

使用:

com.android.support:palette-v7:24.1.1

提供了RecyclerView类,二个像样ListView,可是比ListVIew品质越来越好的控件。日常用来展现大批量多少,能够完全代替ListView。

使用:

com.android.support:recyclerview-v7:24.1.1

提供了一文山会海API,用于帮助成立Material Design风格的首推项页面。官方有一篇指引文书档案,不过认为就算平价了开支,不过灵活性和可定制性不高。

使用:

com.android.support:preference-v7:24.1.1

v4 Support Library

v4库被规划用来包容Android 1.6(API 4)及以上的本子。比较其扶助它库,它满含最多的API,富含程序宽容帮忙、可操作性、UI个性、数据绑定、网络连接、编制程序帮助理工科程师具类。
下边是一些重中之重的类:

4. Multidex Support Library

提供支撑八个dex文件的成效,解决措施65536的范围。

使用:

com.android.support:multidex:1.0.0

title: Android Support Library
tags: Support Library,支持库

7. v14 Preference Support Library

重大是添加了首推项Fragment类-PreferenceFragment和首要推荐项接口-PreferenceFragment.OnPreferenceDisplayDialogCallback,PreferenceFragment.OnPreferenceStartFragmentCallback,PreferenceFragment.OnPreferenceStartScreenCallback。与v7 Preference Support Library烘托使用,参见官方文书档案。

使用:

com.android.support:preference-v14:24.1.1

Accessibility可操作性

  • ExploreByTouchHelper - Adds a helper class for implementing accessibility support for custom views.
  • AccessibilityEventCompat - Adds support for AccessibilityEvent. For more information about implementing accessibility, see Accessibility.
  • AccessibilityNodeInfoCompat - Adds support for AccessibilityNodeInfo.
  • AccessibilityNodeProviderCompat - Adds support for AccessibilityNodeProvider.
  • AccessibilityDelegateCompat - Adds support for View.AccessibilityDelegate.

1. V4 Support Library

支撑Android 1.6(API level 4卡塔尔及以上。它蕴涵了最多的新特色,规范的有:

  • Fragment
  • VIewPager
  • DrawerLayout
  • SlidingPaneLayout

引入:

 compile 'com.android.support:support-v4:24.1.1'

v8 Support Library

引入:Render Script,在支付文书档案中“Develop > API Guides > Computation”中有详尽介绍。
This library is designed to be used with Android (API level 8) and higher. It adds support for the RenderScript computation framework. These APIs are included in the android.support.v8.renderscript package. You should be aware that the steps for including these APIs in your application is very different from other support library APIs. For more information about using these APIs in your application, see the RenderScript developer guide.

Note: Use of RenderScript with the support library is supported with the Android Eclipse plugin and Ant build tools. It is not currently supported with Android Studio or Gradle-based builds.

8. Annotations Support Library

提供对注明的扶助。

使用:

com.android.support:support-annotations:24.1.1

Support Library特性

上面将介绍差异扶植库所提供的严重性意义和支撑的安卓版本。平常,support v4 和 appcompat v7 包是引入被含有到花色中,它们提供了最大规模的Android版本协助,饱含了部分切合UI设计标准的API。

tags: android support library

v7 mediarouter library

This library provides MediaRouter, MediaRouteProvider, and related media classes that support Google Cast.

除此之外最重大的来由,还恐怕有任何几点原因,能够参见谷歌(Google卡塔尔官方文书档案对此的阐述。


最注重的原因就是:为了能在低版本的Android系统上使用高版本的SDK本领有的新功用、新特色。比如,Fragment,ActionBar、Material Design风格等。

Support Library简介

Android Support Library(安卓帮忙库卡塔尔(قطر‎是一多种代码库的成团,提供对中期Android 1.6 (API 4 )系统的合营,并带有部分非常功效的API。每二个库针对不一致的Android平台范围,并提供一定的效应汇集。

Android Support Library只是一个称呼,并非四个确实的library,它由多少个宛在前段时间的library集结而成。种种独立的library都满含部分新特征,能够支撑不相同版本的Android系统,能够被单独引进。日常的话,各类Support Library包罗的新特色都以分裂的,它们交叉互补,以插件化的款型提供对低版本系统的扶持。

先后组件

  1. Fragment
    Static library support version of the framework's Fragment. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework Fragment documentation for a class overview.
    The main differences when using this support version instead of the framework version are:
    • Your activity must extend FragmentActivity
    • You must call getSupportFragmentManager() to get the FragmentManager
  2. NotificationCompat
    Helper for accessing features in Notification introduced after API level 4 in a backwards compatible fashion.
  3. LocalBroadcastManager
    Allows applications to easily register for and receive intents within a single application without broadcasting them globally.

6. v13 Support Library

支撑Android 3.2(API level 13)及以上。这一个library是为在平板上利用Fragment而陈设的,未来应当大约用不到了。

使用:

com.android.support:support-v13:24.1.1

v7系列库

There are several libraries designed to be used with Android 2.1 (API level 7) and higher. These libraries provide specific feature sets and can be included in your application independently from each other.
v7体系库是本着API 7(Android 2.1)及以上系统的,v7体系包涵八个独立的库,可依靠它们的功力和类型要求各自引用。

5. v8 Support Library

支持Android 2.2(API level 8)及以上。

备感相仿的应用级开接受不到(也说不好是作者太弱鸡了),具体依然参谋官方文书档案吧。

参谋文书档案

11. v17 Preference Support Library for TV

提供了在电视平台上,构建首荐项页面包车型客车接口,效能肖似于v7 Preference Support Libraryv14 Preference Support Library

使用:

com.android.support:preference-leanback-v17:24.1.1

v7 gridlayout library网格构造

This library adds support for the GridLayout class, which allows you to arrange user interface elements using a grid of rectangular cells. For detailed information about the v7 gridlayout library APIs, see the android.support.v7.widget package in the API reference.
可以在包android.support.v7.widget下查看全数提供的API,GridLayout 不是适配器视图,不像GridView那样提供一致性的视图项目,能够灵活展现差异的开始和结果,如Android中总括器布局。GridLayout 的后续层级较浅,品质比GridView好。

12. v17 Leanback Library

提供了在电视平台上,用于营造用户分界面的一多种首要控件。以下是局地关键的类:

  • BrowseFragment
  • DetailsFragment
  • PlaybackOverlayFragment
  • SearchFragment

使用:

com.android.support:leanback-v17:24.1.1

谷歌为了使开拓者能够一本万利的引进Support Library,把它们做成了凭借包的方式,通过Gradle能够很方便的引进,比方:

Google把那个高版本SDK才享有的新性子打包进Support Library,当开荒者想行使那么些新特色,又须要优质老版本Android系统时,就能够引进Support Library。当然,那个包裹进Support Library的新特点,全体都被完全的含有在了时尚的Android SDK中。所以一旦开辟者的App仅辅助最新系统,也能够不引进Support Library。

TAG标签:
版权声明:本文由美高梅网投平台发布于计算机网络,转载请注明出处:Android Support Library解释