Android TextureView和硬件加速

tis*_*shu 5 android hardware-acceleration

我正在尝试实现此页面上显示的示例.我试过运行android 4及更高版本的三个不同的设备,并且在所有情况下我得到一个带有此警告的黑屏:

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

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

<application
    android:hardwareAccelerated="true"
    [etc...]
Run Code Online (Sandbox Code Playgroud)

但是下面检查我的自定义视图的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()));          
    }
}
Run Code Online (Sandbox Code Playgroud)

有人知道这里有什么问题吗?

谢谢

Kal*_*esh 0

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