title: How to disable hardware acceleration in a SurfaceView?
body: <p>I'm having this "exact" problem:</p>
  
  <p><a href="https://stackoverflow.com/questions/17410195/setshadowlayer-android-api-differences">setShadowLayer Android API differences</a></p>
  
  <p>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:</p>
  
  <pre><code>public class Screen extends SurfaceView implements Runnable { // Code }
  </code></pre>
  
  <p>So, I just added to the constructor:</p>
  
  <pre><code>public Screen(Context context) {
      super(context);
      holder = getHolder();
      setLayerType(View.LAYER_TYPE_SOFTWARE, null); // Here.
  }
  </code></pre>
  
  <p>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.</p>