Open leviluo opened 1 year ago
android代码如下:
playerViewH.setLoop(Int.MAX_VALUE) playerViewH.setScaleType(ScaleType.CENTER_CROP) var cornerId:String? = null get() = field set(value) { field = value if (!util.isEmpty(value)){ Log.e("head1234",value ?: "") value?.let{ val apkFilePath = AppApplication.instance.applicationContext.getExternalFilesDir("apk")!! .getAbsolutePath() var filePath = apkFilePath + File.separator + "${this.cornerId}.mp4" if (!File(filePath).exists()) { val name = "${this.cornerId}.mp4" FileUtil.CopyAsset( this.context, name, filePath ) } playerViewH.startPlay(File(filePath)) } }else{ playerViewH.stopPlay() } }
问题: 上面是recyclerView 中的一个自定义view,recyclerView刷新,动画就消失了,再次刷新动画又正常,刷新又消失,如此反复
recycleView里面使用会有问题,可以参考#311
android代码如下:
playerViewH.setLoop(Int.MAX_VALUE) playerViewH.setScaleType(ScaleType.CENTER_CROP) var cornerId:String? = null get() = field set(value) { field = value if (!util.isEmpty(value)){ Log.e("head1234",value ?: "") value?.let{ val apkFilePath = AppApplication.instance.applicationContext.getExternalFilesDir("apk")!! .getAbsolutePath() var filePath = apkFilePath + File.separator + "${this.cornerId}.mp4" if (!File(filePath).exists()) { val name = "${this.cornerId}.mp4" FileUtil.CopyAsset( this.context, name, filePath ) } playerViewH.startPlay(File(filePath)) } }else{ playerViewH.stopPlay() } }
问题: 上面是recyclerView 中的一个自定义view,recyclerView刷新,动画就消失了,再次刷新动画又正常,刷新又消失,如此反复