Instead of using android:background attribute, you can use: This is how you can do the same thing using Java. Here is an example: You can even have dashes as an outline around your shape. GitHub is where people build software. android:startColor=@color/your_color_name,