Android TextureView and hardware acceleration

亡梦爱人 提交于 2019-12-10 14:35:50

问题


I am trying to implement the example shown on this page. I have tried on three different devices running android 4 and above, and in all cases I get a black screen with this warning:

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

I have turned on hardware acceleration in the application manifest:

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

But the following check my custom view's onAttachedToWindow method always returns false

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

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

Does anyone know what is wrong here?

Thanks


回答1:


If you testing with Emulator then please check configuration for hardware acceleration. Please check this thread for more info: http://developer.android.com/tools/devices/emulator.html#acceleration



来源:https://stackoverflow.com/questions/14551656/android-textureview-and-hardware-acceleration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!