【问题标题】:SurfaceView lags if in ScrollView如果在 ScrollView 中,SurfaceView 会滞后
【发布时间】:2013-10-08 17:27:14
【问题描述】:

我在ScrollView 中有一个SurfaceView。每当我尝试滚动时,SurfaceView 总是落后一点,留下黑色接缝,它没有覆盖它必须存在的空间。

SurfaceView 我的代码是:

<SurfaceView
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:id="@+id/fragment_stats_hourly_surface_view"
        android:layout_below="@+id/fragment_stats_hourly_view"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:background="@drawable/outline" />

如何设置SurfaceView 以跟上滚动以阻止出现黑缝?

我还应该提到,我开始了一个新项目,其中包含一个空白活动,其中包含一个 ScollView 和一个 SurfaceView,结果相同。

【问题讨论】:

    标签: android android-layout surfaceview


    【解决方案1】:

    试试setDrawingCacheEnabled(false) 对于 SurfaceView 的容器

    【讨论】:

      【解决方案2】:

      您应该在 ICS 及更高版本(即 API 14+)上使用 TextureView

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多