I'm having this "exact" problem:
setShadowLayer Android API differences
I have a player, and enemies, and I'm compiling with 14 API. Problem is: From 14 API on, hardware acceleration is enabled by default, and it is not supported on all drawing methods (For example, the setShadowLayer(), the one that I want to use). So, the solution is simple, just like the one presented in the topic above. Problem is: He uses a View, and I use a SurfaceView for better game performance. My Surface View is declared like this:
public class Screen extends SurfaceView implements Runnable { // Code }
So, I just added to the constructor:
public Screen(Context context) {
super(context);
holder = getHolder();
setLayerType(View.LAYER_TYPE_SOFTWARE, null); // Here.
}
To disable hardware acceleration on my SurfaceView in order to make my shadows not look uggly, and the result: The whole SurfaceView just stops working. I can't show what happens, but It just does not draw anything when I disable hardware acceleration. I'm pretty pessimist about this, because it seems that the SurfaceView itself depends on the hardware acceleration, but the Canvas when drawn into it can't have shadows functioning properly.
According to this the SurfaceView
is not HW accelerated at all, so your problem is probably somewhere else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With