【问题标题】:Android: How to disable content surfaceview position update in Android 7.0Android:如何在 Android 7.0 中禁用内容表面视图位置更新
【发布时间】:2017-05-03 10:21:13
【问题描述】:

我有一个使用 SurfaceView 播放视频的应用。 我们有一个快速的技巧,通过执行 videoSurfaceView.setScaleY(0.5) 来隐藏部分视频内容,它能够隐藏内容的底部。 检查那些图像

Original before scale happen

Expected result after scale

在 Android 7 中: “SurfaceView 对象的内容位置现在与包含的应用程序内容同步更新”,来自谷歌开发者链接:developer.android.com/about/versions/nougat/android-7.0.html#surfaceview

所以在 android 7 中,里面的内容被完美地缩放了。是的,它肯定会修复更多应用程序的错误并减少开发人员的痛苦。

但我不想要它。如何禁用此缩放功能? 如:videoView.setScaleContentIfChange(false)

【问题讨论】:

  • 你尝试了什么。请分享您的代码。
  • ` ObjectAnimator oa = ObjectAnimator.ofFloat(mVideoView, View.SCALE_Y, 1, 0.5f); oa.setDuration(1000); oa.setInterpolator(new DecelerateInterpolator()); oa.start(); `

标签: android surfaceview android-video-player android-7.0-nougat


【解决方案1】:
ObjectAnimator oa = ObjectAnimator.ofFloat(mVideoView, View.SCALE_Y, 1, 0.5f); 
oa.setDuration(1000);
oa.setInterpolator(new DecelerateInterpolator()); 
oa.start();

【讨论】:

    猜你喜欢
    • 2021-07-06
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 2014-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多