fun isPicture(file: File): Boolean {
if (!file.exists()) {
return false
}
val options = BitmapFactory.Options()
BitmapFactory.decodeFile(file.toString(), options)
options.inJustDecodeBounds = true
return when {
options.outWidth != -1 && options.outHeight != -1 -> true
else -> false
}
}
Android判断文件是不是图片
于 2022-03-11 16:58:25 首次发布