Android TextureView 和硬件加速

2024-05-15

我正在尝试实现上所示的示例这一页 http://developer.android.com/reference/android/view/TextureView.html。我已经在运行 android 4 及以上版本的三种不同设备上进行了尝试,在所有情况下我都会遇到黑屏并显示以下警告:

01-27 20:01:22.683: W/TextureView(4728): A TextureView or a subclass can only be used with hardware acceleration enabled.

我已在应用程序清单中打开硬件加速:

<application
    android:hardwareAccelerated="true"
    [etc...]

但以下检查我的自定义视图的 onAttachedToWindow 方法始终返回 false

private class MyTextureView extends TextureView
{
    public MyTextureView(Context context) {
        super(context);
    }

    @Override
    protected void onAttachedToWindow()
    {
        super.onAttachedToWindow();
        Log.d("", Boolean.toString(mTextureView.isHardwareAccelerated()));          
    }
}

有谁知道这里出了什么问题吗?

Thanks


如果您使用模拟器进行测试,请检查硬件加速配置。 请检查此线程以获取更多信息:http://developer.android.com/tools/devices/emulator.html#acceleration http://developer.android.com/tools/devices/emulator.html#acceleration

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android TextureView 和硬件加速 的相关文章

随机推荐