Material-components-android: [MaterialButton] OutlinedButton not showing

Created on 25 Dec 2019  路  12Comments  路  Source: material-components/material-components-android

Description: MaterialButton in Widget.MaterialComponents.Button.OutlinedButton style doesn't show anything.

image

Expected behavior:

image

Source code:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <com.google.android.material.button.MaterialButton
            android:id="@+id/material_button"
            style="@style/Widget.MaterialComponents.Button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Default Button"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/material_unelevated_button"
            style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Unelevated Button"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/materialoutline_button"
            style="@style/Widget.MaterialComponents.Button.OutlinedButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Outlined Button"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/material_text_button"
            style="@style/Widget.MaterialComponents.Button.TextButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Text Button"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/material_icon_button"
            style="@style/Widget.MaterialComponents.Button.Icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Icon Button"
            app:icon="@drawable/success"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/material_icon_text_button"
            style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Icon Text button"
            app:icon="@drawable/success"/>
    </LinearLayout>

Android API version: API Code 25

Material Library version: 1.2.0-alpha03

Device: Android emulator 7.1

It works with 1.1.0-rc01.

bug duplicate

Most helpful comment

This bug reappears in version 1.2.1

All 12 comments

+1
image

I tested this with an API 25 emulator and the outlined button looks fine in the catalog:
image

Did you encounter this issue on an emulator or in the design preview?

@afohrman design preview.

I have the same problem, when I apply the style @style/Widget.MaterialComponents.Button.OutlinedButton
API 29 emulator

I get a Render problem :
java.awt.geom.IllegalPathStateException: missing initial moveto in path definition 聽聽at java.awt.geom.Path2D$Double.needRoom(Path2D.java:1193) 聽聽at java.awt.geom.Path2D.closePath(Path2D.java:1877) 聽聽at android.graphics.Path_Delegate.close(Path_Delegate.java:824) 聽聽at android.graphics.Path_Delegate.nClose(Path_Delegate.java:329) 聽聽at android.graphics.Path.nClose(Path.java:-1) 聽聽at android.graphics.Path.close(Path.java:508) 聽聽at com.google.android.material.shape.ShapeAppearancePathProvider.calculatePath(ShapeAppearancePathProvider.java:123) 聽聽at com.google.android.material.shape.ShapeAppearancePathProvider.calculatePath(ShapeAppearancePathProvider.java:83) 聽聽at com.google.android.material.shape.MaterialShapeDrawable.calculateStrokePath(MaterialShapeDrawable.java:1142) 聽聽at com.google.android.material.shape.MaterialShapeDrawable.draw(MaterialShapeDrawable.java:940) 聽聽at android.graphics.drawable.LayerDrawable.draw(LayerDrawable.java:1011) 聽聽at android.graphics.drawable.DrawableWrapper.draw(DrawableWrapper.java:227) 聽聽at android.graphics.drawable.RippleDrawable.drawContent(RippleDrawable.java:818) 聽聽at android.graphics.drawable.RippleDrawable.draw(RippleDrawable.java:675) 聽聽at android.view.View.drawBackground(View.java:20412) ...

+1, I am also having this exact issue when upgrading from:

com.google.android.material:material:1.1.0-beta01
to
com.google.android.material:material:1.2.0-alpha03

The issue appears to be in the Android Studio layout preview, but not in the app itself. This is a non-starter for my development, and forcing me to stay on Material library 1.1.0 until it is fixed.

I solved this problem with:
implementation 'com.google.android.material:material:1.1.0

I solved this problem with:
implementation 'com.google.android.material:material:1.1.0

Let me know if you find any way to solve this while also being able to leverage Material 1.2.x

I solved this problem with:
implementation 'com.google.android.material:material:1.2.0-alpha02

I solved this problem with:
implementation 'com.google.android.material:material:1.1.0

This bug reappears in version 1.2.1

I have solved the bug by updating the layout viewer in Android Studio, a messaged appeared at the bottom of the issues asking me to update and restart

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sanusy picture Sanusy  路  3Comments

magnusfernandes picture magnusfernandes  路  3Comments

sepehr-alipour picture sepehr-alipour  路  3Comments

Mirmuhsin picture Mirmuhsin  路  3Comments

ataulm picture ataulm  路  3Comments