Android 知识小记

关于分区存储,官方文档的一段:

Access files using direct file paths and native libraries
To help your app work more smoothly with third-party media libraries, Android 11 allows you to use APIs other than the MediaStore API to access media files from shared storage. You can instead choose to access media files directly using either of the following APIs:

The File API.
Native libraries, such as fopen().
If your app doesn’t have any storage permissions, you can access media files that are attributed to your app using direct file paths. If your app has the READ_EXTERNAL_STORAGE permission, it can access all media files using direct file paths, regardless of whether the files are attributed to your app.

If you access media files directly, it’s recommended that you opt out of scoped storage by setting requestLegacyExternalStorage to true in your app’s manifest file. That way, your app behaves as expected on devices that run Android 10.

意思是为了应用能使用第三方的媒体库,Android 11 允许使用分区存储api之外的api访问文件,如Java File相关类,或者c的fopen,如果你有了读取外部文件的权限的话,就可以通过上面的方式访问所有公共媒体文件

另外:
分区存储有一些小优化,对于一些特别文件访问不需要申请存储权限了,比如应用自己下载的
在 Android 11 上,应用无法再访问外部存储设备中的任何其他应用的专用于特定应用的目录中的文件。

使用Palette获取图片的色调等信息
比如现在的根据图片改变ViewPager与Fragement搭配使用时Item的颜色,或者通知栏颜色就可以使用这种方式,让通知栏色调和背景图片颜色一致。
Palette可以提取的颜色如下:
● Vibrant (有活力的)
● Vibrant dark(有活力的 暗色)
● Vibrant light(有活力的 亮色)
● Muted (柔和的)
● Muted dark(柔和的 暗色)
● Muted light(柔和的 亮色)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值