androidandroid-layoutandroid-shapedrawablegradientdrawable

How to get rid of shadow that appears on my button? Android


I have created a button with a Gradient Drawable.

enter image description here

If you look at this button, it has those Extra Grey lines as pointed out by my red arrows. Those don't appear if I create a shape using XML but when i use

Gradient Drawable code seen below it shows these lines. How do I get rid of them??

    GradientDrawable gd = new GradientDrawable();
    gd.setColor(Color.parseColor("#FFFFFFFF")); 
    gd.setCornerRadius(20);
    gd.setStroke(30, Color.parseColor("#0077CC"));
    Button.setBackground(gd);

These become more apparent if i increase the setCorner Radius


Solution

  • Just add style to your button.

    style="?android:attr/borderlessButtonStyle"