Outlined MaterialButton doesn't show any border

Just add this attribute to your MaterialButton

android:theme="@style/Theme.MaterialComponents"

avoid to add it to your main theme.

example:

<com.google.android.material.button.MaterialButton
            android:id="@+id/material_text_button"
            style="@style/Widget.MaterialComponents.Button.OutlinedButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:theme="@style/Theme.MaterialComponents"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:text="Change name"
            android:background="@android:color/transparent"
            android:textSize="12sp"
            app:layout_constraintBottom_toBottomOf="@+id/listTextView2"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/listTextView2"
            app:layout_constraintTop_toTopOf="@+id/listTextView2"
            app:strokeColor="@color/green"
            app:strokeWidth="10dp" />

Use this in your build.gradle app

    implementation 'com.google.android.material:material:1.2.0-alpha02'

I think it is a bug in google material.

Update: I Tested just right now. Use dependency in Gradle app below

implementation 'com.google.android.material:material:1.2.0-alpha05

and in your material button XML, add style

style="@style/Widget.MaterialComponents.Button.OutlinedButton"

it might not show in your xml preview but it will show when you run the app


try removing transparent background and style from your xml. and also make sure to change the style to MaterialComponents.

  <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> 

 <com.google.android.material.button.MaterialButton
        android:id="@+id/btn_login"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:layout_marginStart="20dp"
        android:layout_marginTop="20dp"
        android:textSize="16sp"
        android:layout_marginEnd="20dp"
        android:text="works"
        android:textAllCaps="false"
        android:textColor="@color/white"
        app:strokeColor="@color/white"
        app:strokeWidth="2dp" />