SurfaceView setMeasuredDimension () with height over 4096 crashes
I use surfaceview
in my work. My requirement is to make a curved line in vertical scrolling. When I test this, I found that when the height is less than 4096 it works well, but more than that (even just 4097) it will work!
@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?
+3
source to share
1 answer
The reason may be the maximum supported texture size of your device.
It seems that in your case 4096. You shouldn't use large values ββfor your surface.
Take a look at: How to find the maximum texture size for different phones?
to find what texture sizes are supported
+2
source to share