android 16_现在在android 16

android 16

Welcome to Now in Android, your ongoing guide to what’s new and notable in the world of Android development.

欢迎使用Android Now,这是您持续不断的有关Android开发领域新事物和着名指南。

AndroidX版本 (AndroidX Releases)

As usual, there were many AndroidX libraries released recently. This included new stable releases with bugfixes:

与往常一样,最近发布了许多AndroidX库。 这包括带有错误修正的新的稳定版本:

There were also a veritable plethora of RC, beta, and alpha versions. I’d like to call out just a couple of the new alphas, related to animation. First is the back-port of the Animator APIs as part of Core-Animation 1.0.0-alpha01 as well as the new Vectordrawable-Seekable 1.0.0-alpha01.

还有很多名副其实的RCbetaalpha版本。 我只想讲几个与动画有关的新Alpha。 首先是作为Core-Animation 1.0.0-alpha01以及新的Vectordrawable-Seekable 1.0.0-alpha01一部分的Animator API的后端口。

You might wonder why we unbundled the Animator API. After all, those APIs have been in the platform for longer than the releases your app probably supports at this point (most of them were released in Android Honeycomb, 3.0–3.2). The answer lies in the other library: Vectordrawable-Seekable.

您可能想知道为什么我们取消捆绑Animator API。 毕竟,这些API在平台中的使用时间比此时您的应用程序可能支持的版本更长(它们大多数是在Android Honeycomb 3.0-3.2中发布的)。 答案就在另一个库中:Vectordrawable-Seekable。

One of the oft-requested features for AnimatedVectorDrawable objects was the ability to make them “seekable” — to be able to pause and resume them, and to set their animation position programmatically, instead of just the original fire-and-forget functionality. The problem was that this capability depended upon platform capability for pausing and seeking their underlying animators, which wasn’t added until much later than the original Honeycomb-era APIs.

AnimatedVectorDrawable对象经常需要使用的功能之一是使它们“可搜索”的能力-能够暂停和恢复它们,以及以编程方式设置其动画位置,而不仅仅是原始的“一劳永逸”功能。 问题在于,此功能依赖于平台功能来暂停和查找其基础的动画制作者 ,直到最初的Honeycomb时代API才添加此功能。

So in order to be able to seek/pause/resume AnimatedVectorDrawable objects (especially in the AndroidX unbundled libraries, across older releases), we needed to back-port the Animator APIs to pick up all of the right functionality and fixes.

因此,为了能够查找/暂停/恢复AnimatedVectorDrawable对象(尤其是在旧版本的AndroidX非捆绑库中),我们需要向后移植Animator API,以获取所有正确的功能和修补程序。

Seek and ye shall find [animation]

寻求并找到[动画]

视频和播客形式的NiA16 (NiA16 in Video and Podcast Form)

This Now in Android is also offered in video and podcast form. It’s the same content, but with less reading required. The article version (keep reading!) is still the place to come for links to all of the content that’s covered.

Android中的 This Now还以视频和播客形式提供。 内容相同,但所需的阅读量更少。 仍然可以使用文章版本(请继续阅读!)链接到所涵盖的所有内容。

视频 (Video)

播客 (Podcast)

Click on the link below, or just subscribe to the podcast in your favorite client app.

单击下面的链接,或只订阅您喜欢的客户端应用程序中的播客。

数据潜水 (Data Diving)

Image for post

Murat Yener wrote an article called Database Inspector, which shows how to use the new Database Inspector tool in Android Studio 4.1 canary 6.

Murat Yener撰写了一篇名为Database Inspector的文章,展示了如何在Android Studio 4.1 canary 6中使用新的Database Inspector工具。

With this new tool, you can now see what’s going on in your app’s SQLite database (whether you are using SQLite directly or via the Room persistence library). You can make changes to the data directly in the tool. You can also see live updates to the data in the tool, or see the tool’s updates to the data in the app if you’re using Room and observing changes.

使用此新工具,您现在可以查看应用程序SQLite数据库中发生了什么(无论您是直接使用SQLite还是通过Room持久性库使用 )。 您可以直接在工具中更改数据。 您还可以查看该工具中数据的实时更新,或者,如果您正在使用Room并观察更改,则可以在应用程序中查看该工具对数据的更新。

运算符重载++ (Operator overloading++)

Meghan Mehta posted an article in the Kotlin Vocabulary series on operator overloading. Kotlin allows you to overload standard operators like +, -, and * or even access and comparison operators like [] and <. Operator overloading can make your code more readable when performing standard operations on types that otherwise would not be able to use these operators directly. For example adding two Point objects or multiplying two Matrix objects looks natural and more concise with overloaded operators.

Meghan MehtaKotlin词汇系列中发表了一篇关于运算符重载的文章 。 Kotlin允许您重载+,-和*之类的标准运算符,甚至可以重载[]和<之类的访问和比较运算符。 对类型执行标准操作时,操作符重载可使您的代码更具可读性,否则这些类型将无法直接使用这些操作符。 例如,添加两个Point对象或将两个Matrix对象相乘看起来很自然,并且对于重载运算符来说更加简洁。

The article covers the basics of how to use this feature, as well as pointing out why you might not want to in some situations. Like the other Kotlin Vocabulary pieces, there’s also a description of how it all works under the hood.

本文介绍了如何使用此功能的基础知识,并指出了为什么在某些情况下您可能不想使用此功能。 像其他Kotlin词汇表一样,也有关于它们如何在引擎盖下工作的描述。

材料设计组件 (Material Design Components)

Image for post
Migrate your app to take on the latest material guidance
迁移您的应用以采用最新的材料指导

Nick Rout posted Migrating to Material Components for Android, which talks about the changes in the new Material Design Components 1.1.0 library, along with how to migrate from earlier versions of MDC and the much earlier Design Support Library. Pro tip if you are still using the Design Support library: First migrate to MDC 1.0.0 (which is compatible with AndroidX), then migrate up to 1.1.0.

尼克·罗特(Nick Rout)发布了《 迁移到Android的材料组件》 ,其中讨论了新的材料设计组件1.1.0库中的更改,以及如何从早期版本的MDC和更早的设计支持库进行迁移。 如果您仍在使用设计支持库,请提示:首先迁移到MDC 1.0.0(与AndroidX兼容),然后迁移到1.1.0。

Some of the new features in 1.1.0 include dark theme, full Material Theming support for color, typography, and shape, new widgets like the extended FAB and date picker, and various accessibility improvements and bug fixes.

1.1.0中的一些新功能包括深色主题,对颜色,版式和形状的完全材料主题支持,新的小部件(如扩展的FAB和日期选择器)以及各种可访问性改进和错误修复。

It’s a long article with lots of details, links, and samples; check it out to get the most out of your migration to MDC.

这是一篇长篇文章,其中包含许多详细信息,链接和示例。 进行检查,以充分利用您向MDC的迁移。

Nick also posted a video version of this content:

尼克还发布了此内容的视频版本:

一键式 (One Tap)

Image for post

Sean McQuillan posted an article that explains how to use the new One Tap API for authenticating users in your application. Authentication can be a crucial experience to optimize in order to avoid losing your users if they’re frustrated with the sign-up or sign-in process.

Sean McQuillan发表了一篇文章,解释了如何使用新的One Tap API对应用程序中的用户进行身份验证。 身份验证是优化用户体验的关键体验,可以避免用户对注册或登录过程感到沮丧而使其丢失。

One Tap is part of a broader suite of authentication libraries offered as part of Google Identity Services. That suite is still in development and will be adding more features later, but for now you can use One Tap to create an easy flow for sign-up or sign-in. Stay tuned for more functionality later.

一键式是作为Google身份服务的一部分提供的更广泛的身份验证库套件的一部分。 该套件仍在开发中,以后将添加更多功能,但是现在您可以使用One Tap创建简单的注册或登录流程。 请稍后再关注更多功能。

实时数据 (LiveData)

Jose Alcérreca posted a two-part video on LiveData with Coroutines in his ongoing screencast series:

何塞·阿尔塞卡 (JoseAlcérreca)在他的持续屏幕录像系列中与协发布了两部分的LiveData 视频

Part 1: One-shot Operations explains how to use the LiveData coroutine builder KTX extension function to save on boilerplate code.

第1部分:单操作介绍了如何使用LiveData协程生成器 KTX扩展功能保存样板代码。

Part 2: Parameters with SwitchMap builds on the previous example, showing how to pass parameters with dynamic data as well.

第2部分:使用SwitchMap的参数建立在上一个示例的基础上,该示例还演示了如何将参数与动态数据一起传递。

样例代码 (Sample Code)

位置,位置,位置 (Location, Location, Location)

One of the biggest ongoing changes in the platform in recent releases has been around location, as we make it clearer to the user which apps are using location information and how they can control that use.

最近发布的平台中,最大的持续变化之一就是位置问题,因为我们向用户表明了哪些应用程序正在使用位置信息以及它们如何控制使用情况。

Jeremy Walker has rewritten the Android Location codelab to include more detailed instructions on using location, including best practices for the new policy changes, and more importantly, support for the new Android 11 restrictions.

杰里米·沃克(Jeremy Walker)已重写Android位置代码实验室,以包括有关使用位置的更详细说明,包括新政策更改的最佳做法,更重要的是,支持新的Android 11限制。

The codelab covers the most common use case: retrieving location while the app is being actively used (while your activity is viewable or running as a foreground service with a Notification).

该代码实验室涵盖了最常见的用例:在积极使用该应用程序时(在您的活动可见或作为通知的前台服务运行时)检索位置。

You may also notice that the codelab no longer includes retrieving location from the background. This behavior is not recommended unless you have a valid use case. If you do have such a use case in mind, there is also a new background location sample to check out. It follows the latest best practices for location policy.

您可能还会注意到,代码实验室不再包括从后台检索位置。 除非您有有效的用例,否则不建议这种行为。 如果您确实有这样的用例,那么还有一个新的背景位置示例可供签出。 它遵循位置策略的最新最佳做法。

辅助功能 (Accessibility)

Shailen Tuli created a couple of codelabs to help developers implement accessible applications.

Shailen Tuli创建了两个代码实验室,以帮助开发人员实现可访问的应用程序。

It turns out that most accessibility issues are taken care of for you by the Android libraries (especially when using standard widgets, as opposed to custom views). But even when there are problems, they tend to be relatively easy to fix; the trick is knowing how to find the problems so that you can fix them. The first codelab helps identify common problems in applications, as well as easy fixes for those problems.

事实证明,大多数可访问性问题都是Android库为您解决的(尤其是在使用标准窗口小部件而不是自定义视图时)。 但是即使有问题,它们也往往相对容易解决; 诀窍是知道如何查找问题,以便您可以解决它们。 第一个代码实验室可帮助确定应用程序中的常见问题,以及针对这些问题的简单修复。

Once you’ve implemented an accessible application (which everyone should!), you’ll probably want to add some automated testing, to make sure that any future changes to that app continue to maintain the high level of accessibility that you built in from the start. Shailen’s next codelab covers some of the tools to use, and how you can integrate accessibility testing into your existing Espresso tests.

实施可访问性应用程序后(每个人都应该这样做!),您可能需要添加一些自动化测试,以确保对该应用程序的任何将来更改都将继续保持您从开始。 Shailen的下一个代码实验室涵盖了一些要使用的工具,以及如何将可访问性测试集成到现有的Espresso测试中。

亚行播客节目 (ADB Podcast Episodes)

There have been a couple of episodes of Android Developers Backstage posted since the last Now in Android. Check them out at the links below, or in your favorite podcast client:

自上次在Android中发布Now之后,已经发布了几集Android Developers Backstage。 在下面的链接或您喜欢的播客客户端中查看它们:

ADB 137:可访问性 (ADB 137: Accessibility)

Speaking of accessibility (which I just was — see the two codelabs in the Samples section above!), Tor Norbye, Romain Guy and I had a conversation with Qasid Sadiq and Sally Yuen on the Android Accessibility team, talking about how developers can make their apps more accessible and usable by more people.

说到可访问性(我只是,请参见上面的“示例”部分中的两个代码实验室!), Tor NorbyeRomain Guy和我与Android Accessibility团队的Qasid Sadiq和Sally Yuen进行了交谈,讨论了开发人员如何使他们的越来越多的人可以访问和使用的应用程序。

王座136区 (Episode 136: Remoting)

This episode was a departure from our normal theme of talking to engineers about the tech they work on, and was instead a conversation between Tor, Romain and I about how we have all [mostly] adjusted to the new work-from-home reality.

这一集与我们通常与工程师讨论他们所从事的技术的主题背道而驰,而是在TorRomain和我之间谈论我们如何[主要]适应新的在家工作的现实。

接着… (Now then…)

That’s it for this time. Go get the newest AndroidX library releases! Read the latest articles on Android development techniques! Play with a location or accessibility codelab, or a sample on location access! Listen to the latest ADB podcast episodes! And come back here soon for the next update from the Android developer universe.

这次就是这样。 快去获取最新的AndroidX库版本 ! 阅读有关Android开发技术的最新文章 ! 使用位置可访问性代码实验室,或位置访问示例 ! 收听最新的亚行播客 ! 并很快返回此处,以获取Android开发人员环境的下一个更新。

翻译自: https://medium.com/androiddevelopers/now-in-android-16-9a282ebd3f42

android 16

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值