<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?attr/colorBackgroundFloating" tools:context=".MainActivity" tools:layout_editor_absoluteY="25dp"> <Button android:id="@+id/button_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_weight="1" android:background="@drawable/my_round_button" android:onClick="onClick" android:text="@string/button_1" android:visibility="visible" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> 

my_round_button

 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring"> <solid android:color="#FFFFFF"/> </shape> 

Explain what is wrong

    1 answer 1

    Replace

     android:shape="ring" 

    on

     android:shape="rectangle" 

    To round corners, use corners :

     <corners android:bottomRightRadius="16dp" android:bottomLeftRadius="16dp" android:topRightRadius="16dp" android:topLeftRadius="16dp"/> 

    Full markup:

     <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#eeff0000" /> <corners android:bottomRightRadius="16dp" android:bottomLeftRadius="16dp" android:topRightRadius="16dp" android:topLeftRadius="16dp"/> </shape> 
    • Not displayed - Ahillesius
    • In your my_round_button markup, white is set, if the background is white, then it will seem like it is not displayed. Copy into your my_round_button all the markup code that I dropped, and then it will be displayed. - McDaggen
    • did so as written - Ahillesius
    • If you do not install the background button, it is displayed? - McDaggen
    • if not installed, then it is displayed - Ahillesius 8:49 pm