Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here we go</p> <p><img src="https://i.imgur.com/cKi1ckX.png" alt="http://i.imgur.com/cKi1ckX.png"> Yup I still dig the Nexus S</p> <p>First of all, please stop masking bitmaps that way, you can accomplish this without allocating another <code>Bitmap</code>, checkout <a href="http://evel.io/2013/07/21/rounded-avatars-in-android/" rel="noreferrer">this blog post about how to draw rounded (and actually any shape) images</a>.</p> <p>Second using that <code>Drawable</code> you probably can figure out how to add your shadow, just make sure it does not get clipped, on 18+ you could use <code>ViewOverlay</code>s for that, also keep in mind that <a href="http://developer.android.com/guide/topics/graphics/hardware-accel.html#unsupported" rel="noreferrer">there are several unsupported drawing operations for hardware accelerated layers</a>, that includes <code>setShadowLayer</code> and <code>BlurMaskFilter</code>, if performance is not an issue for you, you can disable it as always:</p> <pre class="lang-java prettyprint-override"><code>if (SDK_INT &gt;= HONEYCOMB) { view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } </code></pre> <p>And use <code>setShadowLayer</code> as you were trying already:</p> <pre class="lang-java prettyprint-override"><code>somePaint.setShadowLayer(shadowSize, deltaX, deltaY, shadowColor); </code></pre> <p>For a sample please check the link at the end.</p> <p>If you still want to be hardware accelerated you will have to fake it at risk of overdrawing, you could use a radial gradient or draw another oval blurring it yourself (as mentioned before can't use <code>BlurMaskFilter</code>) or use a pre-blurred <code>Bitmap</code> (more masking).</p> <p>For such a subtle shadow I would rather just go flat if performance is required, <a href="https://gist.github.com/eveliotc/6105241" rel="noreferrer">the full sauce is in the banana stand</a>.</p> <p>Update: <a href="http://developer.android.com/preview/material/index.html" rel="noreferrer">Starting L you can use real shadows</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload