Android Button's background as shape with Shadow

前端 未结 6 1328
南旧
南旧 2021-02-02 03:54

I\'ve made a button background from shapes and is looking quite good for my purpose. The only thing needed is to drop a bit of shadow for it. Here is the code:

         


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 04:24

    Paint mShadow = new Paint(); 
    // radius=10, y-offset=2, color=black 
    mShadow.setShadowLayer(10.0f, 0.0f, 2.0f, 0xFF000000); 
    // in onDraw(Canvas) 
    canvas.drawBitmap(bitmap, 0.0f, 0.0f, mShadow);
    

    This code is from Android's Romain Guy available here : http://www.devoxx.com/download/attachments/1705921/D8_C_10_09_04.pdf

提交回复
热议问题