视频直播系统源码,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() {
override fun onResourceReady(resource: File, glideAnimation: Transition?) {
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大连无痛人流医院 http://www.bhbyby.net/
&& 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?) {
}
})
}
- 点赞
- 收藏
- 关注作者
评论(0)