stepstone-tech / android-material-stepper

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

How can i change the back button background with androidx #285

Open shanu95 opened 4 years ago

shanu95 commented 4 years ago

I'm using the library with latest androidx and when i set the back button background it doesnt working. it aligns to end of the left and only changes background to colorprimary. not working as mentioned. anyway to fix the problem? if set the background to transparent it works but clicking ripple effect not working. if i set the background to ?android:selectableItemBackground it works but if set ?android:selectableItemBackground to both next and back button next button aligns to the end of the right. how to fix this problem?

<com.stepstone.stepper.StepperLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/stepperLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:ms_bottomNavigationBackground="@color/white" app:ms_stepperType="progress_bar" app:ms_backButtonBackground="@color/colorPrimaryDark" app:ms_showBackButtonOnFirstStep="true" app:ms_activeStepColor="@color/colorPrimary" app:ms_nextButtonColor="@color/colorPrimary" app:ms_backButtonColor="@color/colorPrimary" app:ms_completeButtonColor="@color/colorPrimary" />

olsey commented 3 years ago

Back button is a MaterialButton, so it is directly related with the <item name="colorPrimary">@color/your_color</item>

One way is to change that and your button will be that color, other way is this: ((ViewGroup)((ViewGroup) stepperLayout).getChildAt(2)).getChildAt(2).setBackgroundColor(getResources().getColor(R.color.Green)); or change tint color like this