有什么理由在 Android 中使用 support.v4 库吗? [英] Is there any reason to use the support.v4 library in Android?

查看:23
本文介绍了有什么理由在 Android 中使用 support.v4 库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一款面向 Android 4.0 及更高版本的应用,不打算支持早期版本.有什么好的理由让我继续使用支持库吗?

I've been working on an app that is targeting Android 4.0 and above with no plans of supporting earlier versions. Is there any good reasons for me to continue using the support library?

推荐答案

有许多功能 适用于所有 API 级别的支持库独有:

There are a number of features unique to the support library that apply to all API levels:

  • LocalBroadcastManager - 允许应用程序在一个单个应用程序,无需全局广播.
  • ViewPager - 添加管理子视图布局的 ViewGroup,用户可以在其中滑动.
  • DrawerLayout - 添加对创建 导航抽屉,可从窗口边缘拉入.
  • SlidingPaneLayout - 添加小部件,用于创建适当的链接摘要和详细信息视图适应各种屏幕尺寸.
  • FileProvider - 添加对在应用程序之间共享私人文件的支持.
  • LocalBroadcastManager - Allows applications to easily register for and receive intents within a single application without broadcasting them globally.
  • ViewPager - Adds a ViewGroup that manages the layout for the child views, which the user can swipe between.
  • DrawerLayout - Adds support for creating a Navigation Drawer that can be pulled in from the edge of a window.
  • SlidingPaneLayout - Adds widget for creating linked summary and detail views that appropriately adapt to various screen sizes.
  • FileProvider - Adds support for sharing of private files between applications.

以及其他诸如

  • WakefulBroadcastReceiver - 实现 BroadcastReceiver 的通用模式的助手,该模式接收设备唤醒事件,然后将工作传递给服务,同时确保设备在转换期间不会重新进入睡眠状态.
  • AtomicFile - 用于对文件进行原子操作
  • SwipeRefreshLayout - 添加下拉刷新视图
  • WakefulBroadcastReceiver - Helper for the common pattern of implementing a BroadcastReceiver that receives a device wakeup event and then passes the work off to a Service, while ensuring that the device does not go back to sleep during the transition.
  • AtomicFile - for atomic operations on a file
  • SwipeRefreshLayout - adds pull to refresh to a view

另请注意一些较新的功能,例如 nested Fragments(已添加仅在 Android 4.2 中)在 Fragments 的支持库版本中可用.Renderscript 内部函数也仅在 Android 4.2 中引入,如果您正在执行诸如实时图像处理.大样式通知和通知操作(在 Android 4.1 中引入)更易于使用当使用 NotificationCompat(以及 Android Wear Notification API 建立在它之上.

Also note that some newer features, such as nested Fragments (which were added only in Android 4.2) are available in the support library versions of Fragments. Renderscript intrinics were also only introduced in Android 4.2 and important if you are doing things such as real time image processing. Big style notifications and notification actions (introduced in Android 4.1) are much easier to work with when using NotificationCompat (and the Android Wear Notification API is built on it).

这篇关于有什么理由在 Android 中使用 support.v4 库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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