Edit: The easiest solution is to get rid of rounded corners. If you remove the rounded corners and use a simple rectangle, the hardware rendering will no longer create one large texture for the background layer and will no longer exceed the texture size limit.
One simple way to solve the problem is to return to software rendering for this view:
View view = findViewById(R.id.textView1); view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
... but we ran into a similar problem, and we got the same result as you, the view (and its children) did not display.
You can also set the view layer type from XML :
<TextView android:layerType="software" />
Setting the layerType type to "none" instead of software seems to trigger a scan, but it painted without rounded corners in the quick test we just tried.
Another approach could be to use another way to render a rounded rectangle, for example.
- cropping and drawing paths in
onDraw - using
PaintDrawable (which supports rounded corners, but must be set from code) - the rectangle is divided into three sections - the top (with rounded corners), middle (only solid color) and the bottom (with rounded corners).
source share