user3384194
user3384194

Reputation: 141

Shadow round corners Android

how can i make a shadow for round corners? I tried it with views for the bottom, right an the corner, but that works not really :D I tried this xml for the corner:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">    
  <gradient
      android:startColor="#404040"
      android:centerColor="#DBDBDB"
      android:endColor="@color/shadow_end"
      android:angle="315"
      >
  </gradient>
  <corners
   android:bottomRightRadius="5dp"
   android:bottomLeftRadius="0dp"
   android:topLeftRadius="0dp"
   android:topRightRadius="0dp"/>
</shape>

Is it good to use views for shadows? What you are using?

Thanks for help :)

Upvotes: 2

Views: 1519

Answers (1)

Rick
Rick

Reputation: 4013

You can simply draw a 9-patch image with Photoshop drawing the shadows and put it into the drawable folders and set this in your View in xml:

android:background="@drawable/your_9patch_image"

I always do it by using Photoshop. For more details see this: Draw 9-patch

Or you can check in the default Android Studio drawables and see if there's one that you like. Check my answer here: my answer

Upvotes: 2

Related Questions