1

[SOLVED]: Marked the working answer

How do I get rid of these grey triangles appearing on the corner of my customized button. Posted a PNG below and the customized button xml code as well as the actual button itself with its current properties.

enter image description here .

Customized button xml (drawables):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <corners
        android:radius="12dp"
        />

    <padding
        android:left="0dp"
        android:top="0dp"
        android:right="0dp"
        android:bottom="0dp"
        />

    <size
        android:width="200dp"
        android:height="60dp"
        />

    <stroke
        android:width="3dp"
        android:color="#D8134B"
        />
</shape>

Button:

<Button
    android:id="@+id/easyButton"
    android:layout_width="200dp"
    android:layout_height="60dp"
    android:layout_gravity="center_horizontal"
    android:layout_marginTop="40dp"
    android:background="@drawable/button_shape_playactivity"
    android:fontFamily="casual"
    android:text="@string/easy"
    android:textAllCaps="false"
    android:textColor="#4c4c4c"
    android:textSize="20sp"
    android:textStyle="bold" />
Fisnik B.
  • 125
  • 8
  • 2
    Maybe you need to make the background transparent? http://stackoverflow.com/questions/4954102/button-background-as-transparent – Al Lelopath Mar 23 '17 at 15:42

2 Answers2

2

Try this and see if they work This is what i use for outline.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:radius="10dp"
        android:topRightRadius="10dp"
        android:bottomRightRadius="10dp"
        android:bottomLeftRadius="10dp" />
    <stroke
        android:width="4dp"
        android:color="@android:color/black" />
    <solid android:color="@android:color/transparent"/>
</shape>

or if you would like to change colors on button pressed etc i use this

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_pressed="true" >
        <shape android:shape="rectangle"  >
            <corners android:radius="15dip" />
            <stroke android:width="1dip" android:color="#5e7974" />
            <gradient android:angle="-90" android:startColor="#00ccff" android:endColor="#00ccff"  />
        </shape>
    </item>
    <item android:state_focused="true">
        <shape android:shape="rectangle"  >
            <corners android:radius="15dip" />
            <stroke android:width="1dip" android:color="#00ccff" />
            <solid android:color="#66c3d0"/>
        </shape>
    </item>
    <item >
        <shape android:shape="rectangle"  >
            <corners android:radius="15dip" />
            <stroke android:width="1dip" android:color="#14bbfb" />
            <gradient android:angle="-90" android:startColor="#00ccff" android:endColor="#00ccff" />
        </shape>
    </item>
</selector>
chirag90
  • 2,211
  • 1
  • 22
  • 37
  • 1
    @Shashanth, sorry i had the snippet on bitbucket so i just used that link, however thank you for your comment i have removed the link and put the code in. – chirag90 Mar 23 '17 at 16:04
  • 1
    Thanks a lot man. This actually worked. It still shows the rectangles on the UI's preview, however when starting the app on the emulator it dissapears now. – Fisnik B. Mar 23 '17 at 18:02
1

The grey triangle will gone if you run using your real device

enter image description here

John Joe
  • 12,412
  • 16
  • 70
  • 135
  • 1
    Thanks bro! Have you tried to check if they do appear when using the emulator just in case? [ EDIT ] Checked works now :). – Fisnik B. Mar 23 '17 at 18:02
  • No,I have some problem with my emulator. – John Joe Mar 24 '17 at 01:05
  • 2
    It works good now. I did some changes with help from an answer higher up. I marked the answer that helped. But like I said the problem is actually in Android. It shows that on the preview, but when I play the app on the emulator it dissapears. Are you on Skype now by the way? – Fisnik B. Mar 24 '17 at 12:23