视频直播系统源码,Android显示大图长图不模糊的方法
视频直播系统源码,Android显示大图长图不模糊的方法实现的相关代码
```handlebars fun loadLargeImage(context: Context, res: String, imageView: SubsamplingScaleImageView) { imageView.isQuickScaleEnabled = true imageView.maxScale = 15F; imageView.isZoomEnabled = true; imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM) Glide.with(context).asFile().load(res).into(object : CustomTarget<File?>() { override fun onResourceReady(resource: File, glideAnimation: Transition<in File?>?) { val sWidth = BitmapFactory.decodeFile(resource.absolutePath).width val sHeight = BitmapFactory.decodeFile(resource.absolutePath).height val wm = ContextCompat.getSystemService(context, WindowManager::class.java) val point = Point() wm!!.defaultDisplay.getSize(point) val height = point.y//测量不包括标题栏和状态栏的高度 if (sHeight >= height && sHeight / sWidth >= 3) { imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CENTER_CROP) imageView.setImage(ImageSource.uri(Uri.fromFile(resource)), ImageViewState(0.5f, PointF(0f, 0f), 0)) } else { imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM) imageView.setImage(ImageSource.uri(Uri.fromFile(resource))) imageView.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_CENTER_IMMEDIATE) } } override fun onLoadCleared(placeholder: Drawable?) { } }) } ```
以上就是视频直播系统源码,Android显示大图长图不模糊的方法实现的相关代码, 更多内容欢迎关注之后的文章