Android的TextureView和硬件加速 [英] Android TextureView and hardware acceleration
问题描述
我想实现在此页面所示的例子。我已经尝试了三种不同的设备上运行的Android 4.0及以上,且在任何情况下,我得到一个黑色的屏幕,这样的警告:
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...]
但接下来的检查我的自定义视图的onAttachedToWindow方法始终返回false
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?
感谢
推荐答案
如果您测试与仿真器,那么请检查配置硬件加速。 请检查此线程的详细信息: http://developer.android.com/tools/devices/emulator.html#acceleration
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
这篇关于Android的TextureView和硬件加速的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!