MaterialButtonToggleGroup remove default border

685 views Asked by At

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

There are 2 answers

2
gurkan On BEST ANSWER

Add this to the button xml:

android:stateListAnimator="@null" 

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

0
Gabriele Mariotti On

Use in your MaterialButton the strokeWidth attribute:

       <com.google.android.material.button.MaterialButton
            style="?attr/materialButtonOutlinedStyle"
            app:strokeWidth="0dp"