前端做网站直播,做可以上传文件的网站,广告创意制作,潍坊市坊子区建设局网站好久不见#xff0c;真的挺久了#xff0c;之前一个月写的文章比现在多半年的都多。今年第一篇文章是简单写了下 Android 14 的适配#xff1a;Android 14 又来了#xff1f;别扶#xff01;抬起我来吧#xff01;
今天咱们来一起看看 Compose Accompanist 吧#xff0…
好久不见真的挺久了之前一个月写的文章比现在多半年的都多。今年第一篇文章是简单写了下 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 完成一部优秀曲子吧
System UI Controller 方便大家对状态栏、导航栏的控制AppCompat Theme Adapter 可以重用 AppCompat XML主题用于在 Compose 中进行主题化Material Theme Adapter 可以重用 Material 2 XML 主题用于在 Compose 中进行主题化Material 3 Theme Adapter 可以重用 Material 3 XML 主题用于在 Compose 中进行主题化Permissions 一个为Compose 提供运行时权限支持的库Navigation-Material 为 Navigation 提供 Material 支持例如 bottom sheetsDrawable Painter 提供了一种使用 Drawables 作为 Compose painter 的方法Web 用于在 Compose 中支持基本的 WebViewAdaptive 为自适应布局提供实用程序集合的库Test Harness 用于测试 Compose 布局的库
上面这些就是目前 Accompanist 还未废弃的库其实也没剩几个了。。。
演奏完成的曲子
演奏中的曲子还在演奏大家也还可以继续使用接下来看下已经演奏完成的曲子吧虽然已经演奏完成但也可以用来学习他们演奏的手法及技巧
Swipe to Refresh (Deprecated) 顾名思义用于下拉刷新的库Pager (Deprecated) 可以让大家在 Compose 中使用类似 ViewPager 的库Flow Layouts (Deprecated)流布局Navigation-Animation (Deprecated)为 Nagation 提供动画比如淡入淡出、滑入滑出等等Placeholder (Deprecated)用于在加载内容时显示占位符UIInsets (Deprecated Removed)使用 IME
其实演奏完成的库之前我都用过还是挺好的但是车轮总是向前走的实验性的 API 肯定还是 Release 后更好
Accompanist 的全部代码都放在了 Github 中地址为https://github.com/google/accompanist
大家可以去 Github 中下载代码学习学习当然也可以在线看Github 现在的在线预览代码还是很舒服的 演出完成
OK今天的演出到这就结束了准备写一个系列把 Accompanist 中的库一个一个都说一说聊一聊还可以再聊一聊我之前使用过但是现在已经废弃的库现在应该如何迁移或者说现在库废弃了应该如何使用这个功能。