title: How to check, if `onDraw` is called in preview mode
body: <p>In my custom-drawn view I use the <code>Canvas.drawPaint(Paint)</code> method. But the preview in Android Studio displays this message: </p>
  
  <pre class="lang-none prettyprint-override"><code>The graphics preview in the layout editor may not be accurate: 
      - Canvas.drawPaint is not supported
  </code></pre>
  
  <p>It's easy to replace <code>drawPaint</code> with <code>drawRect</code>, but the javadoc to <code>drawPaint</code> says: <em>This is equivalent (but faster) to drawing an infinitely large rectangle with the specified paint.</em></p>
  
  <p>My question is: can I check, if I'm drawing in preview mode, and conditionally use either method? Or some other workaround to make preview working and keep the performance?</p>