一起来看看 Compose Accompanist

好久不见,真的挺久了,之前一个月写的文章比现在多半年的都多。今年第一篇文章是简单写了下 Android 14 的适配:Android 14 又来了?别扶!抬起我来吧!

今天咱们来一起看看 Compose Accompanist 吧!

什么是 Compose Accompanist

首先来看下官方的解释吧!

Accompanist is a group of libraries that aim to supplement Jetpack Compose with features that are commonly required by developers but not yet available.

很简单,Accompanist 是一组库,旨在为 Compose 提供开发人员通常需要但尚未可用的功能。

不得不说,Google 是挺会起名字的,Accompanist 翻译过来是伴奏者,那么谁是作曲者呢?显而易见 Compose 就是作曲者了!Compose 作曲,Accompanist 来伴奏,挺好!

光这样看这个库很好啊!帮助大家更好地使用 Compose ,但真的是这样么?咱们接着往下看:

Accompanist is a labs like environment for new Compose APIs. We use it to help fill known gaps in the Compose toolkit, experiment with new APIs and to gather insight into the development experience of developing a Compose library. The goal of these libraries is to upstream them into the official toolkit, at which point they will be deprecated and removed from Accompanist.

吓人不?有可能用着用着就废弃了。。。。不过也是一个好事,相当于这些需要使用的库都变为了正式版本,从这里废弃后就直接放到了 Compose 的库里了,就是咱们都不需要另外进行引用依赖了。

演奏中的曲子

好了,下面来看下 Accompanist 都怎么帮助 Compose 完成一部优秀曲子吧!

上面这些就是目前 Accompanist 还未废弃的库,其实也没剩几个了。。。

演奏完成的曲子

演奏中的曲子还在演奏,大家也还可以继续使用,接下来看下已经演奏完成的曲子吧!虽然已经演奏完成,但也可以用来学习他们演奏的手法及技巧!

  • Swipe to Refresh (Deprecated) :顾名思义,用于下拉刷新的库
  • Pager (Deprecated) :可以让大家在 Compose 中使用类似 ViewPager 的库
  • Flow Layouts (Deprecated):流布局
  • Navigation-Animation (Deprecated):为 Nagation 提供动画,比如淡入淡出、滑入滑出等等
  • Placeholder (Deprecated):用于在加载内容时显示占位符UI
  • Insets (Deprecated & Removed):使用 IME

其实演奏完成的库之前我都用过,还是挺好的,但是车轮总是向前走的,实验性的 API 肯定还是 Release 后更好!

Accompanist 的全部代码都放在了 Github 中,地址为:github.com/google/acco...

大家可以去 Github 中下载代码学习学习,当然也可以在线看,Github 现在的在线预览代码还是很舒服的!

演出完成

OK,今天的演出到这就结束了,准备写一个系列,把 Accompanist 中的库一个一个都说一说,聊一聊,还可以再聊一聊我之前使用过,但是现在已经废弃的库,现在应该如何迁移,或者说现在库废弃了应该如何使用这个功能。

相关推荐
2501_9159090612 小时前
iOS 应用反调试技详解术 检测调试器的原理与防护实践
android·ios·小程序·https·uni-app·iphone·webview
Lvan的前端笔记12 小时前
AndroidX 完全入门指南
android·androidx
帅次13 小时前
Android 应用高级面试:Window 近1年高频追问 18 题
android·面试·职场和发展
总捣什么乱113 小时前
MySQL MySQL是怎么保证主备一致的?
android·mysql·adb
zzm62814 小时前
精读 HinDroid:基于异构信息网络的安卓恶意软件检测
android
weixin_4407841114 小时前
Android基础知识汇总
android·java·android studio
sbjdhjd14 小时前
安全初级 | Upload 文件上传漏洞实操
android·经验分享·安全·网络安全·开源·php·apache
small-pudding15 小时前
Cocos Creator Android 热更新方案实践:逻辑更新、远程 Bundle 与线上回滚
android
00后程序员张15 小时前
iOS加固技术路线全面解析:Bitcode模式、源码模式与汇编模式对比及爱加密优势
android·汇编·ios·小程序·uni-app·cocoa·iphone
yunsr15 小时前
PHP函数及漏洞防御
android·开发语言·php