SurfaceView setMeasuredDimension() with height greater than 4096 crashes

给你一囗甜甜゛ 提交于 2019-12-23 17:37:01

问题


I'm using surfaceview in my work. My requirement is to make a curved line in a vertical scrollview. When I test it I found when the height is less than 4096 it works well, but more than that (even just 4097), it crashes!

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // TODO Auto-generated method stub
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 4097);
}

Can anyone tell me why?


回答1:


The reason might me the max supported texture size of your device.

Which seem to be 4096 in your case.You should not use bigger values for your surface.

Take a look at: How can I find the maximum texture size for different phones?

to find what texture sizes are supported



来源:https://stackoverflow.com/questions/31020482/surfaceview-setmeasureddimension-with-height-greater-than-4096-crashes

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