1

I am new to android development and I need some help removing the borders from the MaterialButtonToggleGroup.

enter image description here

Any help is appreciated

Edit

<com.google.android.material.button.MaterialButtonToggleGroup android:id="@+id/toggleGroup"

    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_below="@+id/companyName"
    android:layout_centerInParent="true"
    app:checkedButton="@id/btnAll"
    app:singleSelection="true"
    app:selectionRequired="true"
    android:gravity="center"
            >

    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnAll"

        app:cornerRadius="0dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="13sp"
        android:text="All"
        android:gravity="center_vertical|end"
        android:paddingRight="15dp"

      

        />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnProgram"
        app:cornerRadius="0dp"
        style="@style/ToggleButtonGroupStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:paddingRight="15dp"



        android:textSize="13sp"
         />
</com.google.android.material.button.MaterialButtonToggleGroup>

2 Answers2

1

Add this to the button xml:

android:stateListAnimator="@null" 

more info: https://stackoverflow.com/a/31003693/10277150

gurkan
  • 66
  • 5
  • Is there a way to keep the bottom border but only remove the top and thank you that worked perfectly. – Mahad Hassan May 20 '21 at 22:08
  • try this please : android:outlineProvider="bounds" and check the link : [link]https://stackoverflow.com/questions/27477371/android-elevation-not-showing-a-shadow – gurkan May 20 '21 at 22:12
1

Use in your MaterialButton the strokeWidth attribute:

       <com.google.android.material.button.MaterialButton
            style="?attr/materialButtonOutlinedStyle"
            app:strokeWidth="0dp"
Gabriele Mariotti
  • 192,671
  • 57
  • 469
  • 489