Background color in xml ANDROID

0

I have the following code fragment

XML button

  <Button
            android:id="@+id/strBtnAssociateDevice"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/round_borderCustom"
            android:onClick="GoToConfirmationNumber"
            android:text="@string/activity_login_loginButton"
            android:layout_marginTop="45dp"
            />

The android's xml: background is

    <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners android:radius="00dp" />
    <solid android:color="#ffffff" />
    <stroke
        android:width="1dip"
        android:color="@color/colorAccent"
        />

</shape>

where I use it to put it on a button that generates me

What I would like is to be able to leave the bottom of the button in full red,

    
asked by Bruno Sosa Fast Tag 03.01.2018 в 20:10
source

1 answer

1

The solid attribute indicates the background color of your shape , in the code you show you have it blank, assuming that @color/colorAccent is red then you could do it this way:

   <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <corners android:radius="00dp" />
    <solid android:color="@color/colorAccent" />
    <stroke
        android:width="1dip"
        android:color="@color/colorAccent"
        />

</shape>
    
answered by 03.01.2018 / 21:19
source