stepstone-tech / android-material-stepper

This library allows to use Material steppers inside Android applications.
Apache License 2.0
1.78k stars 263 forks source link

back button color cannot be changed #274

Open wisien92 opened 6 years ago

wisien92 commented 6 years ago

Hi,

I can't seem to change the back button background color (as well as next or complete).

I have changed the colors to be greyish - but this changes only text color.

        <com.stepstone.stepper.StepperLayout
        android:id="@+id/stepperLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingStart="8dp"
        android:paddingTop="16dp"
        android:paddingEnd="8dp"
        app:ms_backButtonColor="#707070"
        app:ms_completeButtonColor="#707070"
        app:ms_nextButtonColor="#707070"
        app:ms_showBackButtonOnFirstStep="true"
        app:ms_stepperType="dots"
        tools:theme="@style/AppTheme"/>

Yet my back button has the same color as my app accent. I have tried setting backbutton drawable also but without any effect. Is it possible that overriding getViewModel in adapter is causing this?

wisien92 commented 6 years ago

I made a workaround for that

    findViewById<View>(com.stepstone.stepper.R.id.ms_stepPrevButton).backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, android.R.color.white))

but it's kinda ugly - setting background tint would be nice btw.

abir-hasan commented 5 years ago

In my case back-button was taking the colorPrimary as it's background. Theme.MaterialComponents.Light.DarkActionBar was my parent theme. When i made another custom style with Theme.AppCompat.Light.DarkActionBar then back button reverted back to it's original color.

zawadz88 commented 5 years ago

Hi, Sorry for replying so late. To change the background color of a button you need to use ms_backButtonBackground instead. See: https://github.com/stepstone-tech/android-material-stepper#view-attributes There's an example in the sample app if I remember correctly.

abir-hasan commented 5 years ago

Hi, Sorry for replying so late. To change the background color of a button you need to use ms_backButtonBackground instead. See: https://github.com/stepstone-tech/android-material-stepper#view-attributes There's an example in the sample app if I remember correctly.

I've used ms_backButtonBackground but it wasn't working due to material theme. When i reverted back to appCompat theme, then it worked. So i'm guessing there might be an issue with this library theme and material theme compatibility.

Renk01 commented 5 years ago

Hi Guys, I had the same issue. After switching my app theme, in order to use material theme the background of the back-button was set to the accent color of my app. After i added app:ms_backButtonBackground="@android:color/transparent" everything was fine again.