dmytrodanylyk / android-process-button

Android Buttons With Built-in Progress Meters.
http://dmytrodanylyk.com/pages/portfolio/portfolio-process-button.html
MIT License
3.01k stars 546 forks source link

Unable to change button color #68

Open greenreader9 opened 1 month ago

greenreader9 commented 1 month ago

Hello

Having some trouble implementing your code, I can't seem to change the color of the button, it always stays at the default that you have configured.

activity_name.xml:

    <com.dd.processbutton.iml.ActionProcessButton
        android:id="@+id/signupButton"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="24dp"
        app:layout_constraintTop_toBottomOf="@+id/passwordEditText"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        android:text="@string/create_account"
        android:textColor="@android:color/white"
        android:textSize="18sp"
        custom:pb_colorNormal="@color/colorPrimary"
        custom:pb_colorPressed="@color/colorPrimaryVariant"/>

colorPrimary and colorPrimaryVariant are defined in colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="colorPrimary">#BA85FB</color>
    <color name="colorPrimaryVariant"><![CDATA[@color/purple_700]]></color>
    <color name="colorOnPrimary">#FFFFFF</color>

</resources>

activity.java:

ProgressGenerator progressGenerator = new ProgressGenerator(this);
ActionProcessButton signupButton = (ActionProcessButton) findViewById(R.id.signupButton);
signupButton.setMode(ActionProcessButton.Mode.ENDLESS);

The button should be purple, but it is still blue:

image

Am I missing something in the XML file?

Thank you

Vik452 commented 2 weeks ago

![Uploading IMG20240830222205.jpg…]()

greenreader9 commented 2 weeks ago

![Uploading IMG20240830222205.jpg…]()

Looks like that image did not fully upload, can you try again?