Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having Issue applying style on StepperLayout #290

Open
kevintorch opened this issue Jan 31, 2020 · 1 comment
Open

Having Issue applying style on StepperLayout #290

kevintorch opened this issue Jan 31, 2020 · 1 comment

Comments

@kevintorch
Copy link

kevintorch commented Jan 31, 2020

Styles are not applying on Stepper Layout. I've added "ms_stepperStyle" in main application theme as shown below.

`

<style name="AppTheme.Default">
    <item name="appBarLayoutBackground">?colorPrimary</item>
    <item name="ms_stepperStyle">@style/StepperStyle</item>
    <item name="bottomNavigationStyle">@style/Widget.eduCare.BottomNavigationView</item>
    <item name="toolbarIconTint">@color/appColorOnDarkSurfaceHighEmphasis</item>
    <item name="appTextColorPrimary">@color/white</item>
    <item name="toolbarStyle">@style/Widget.eduCare.Toolbar.Primary</item>
</style>

<style name="StepperStyle" parent="MSDefaultStepperLayoutTheme">
    <item name="ms_bottomNavigationStyle">@style/Widget.StepperStyle.BottomNavigation</item>
    <item name="ms_backNavigationButtonStyle">@style/Widget.StepperStyle.Button.Back</item>
    <item name="ms_nextNavigationButtonStyle">@style/Widget.StepperStyle.Button.Next</item>
    <item name="ms_completeNavigationButtonStyle">@style/Widget.StepperStyle.Button.Complete
    </item>
</style>

<style name="Widget.StepperStyle.BottomNavigation" parent="">
    <item name="android:layout_height">200dp</item>
    <item name="android:background">?colorSurface</item>
    <item name="elevation">16dp</item>
</style>

<style name="Widget.StepperStyle.Button" parent="Widget.eduCare.Button.TextButton" />

<style name="Widget.StepperStyle.Button.Back" parent="Widget.eduCare.Button.TextButton"></style>

<style name="Widget.StepperStyle.Button.Next"></style>

<style name="Widget.StepperStyle.Button.Complete">
    <item name="android:text">Save</item>
</style>

`

but the style is not being applied.

And here is StepperLayout

<com.stepstone.stepper.StepperLayout android:id="@+id/stepperLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:ms_stepperType="dots" app:ms_activeStepColor="?appColorPrimaryDark" app:ms_errorColor="?appColorError" app:ms_completeButtonColor="?appColorPrimaryDark" app:ms_nextButtonColor="?appColorPrimaryDark" app:ms_backButtonColor="?appColorPrimaryDark" app:ms_backButtonBackground="@color/caldroid_transparent" app:ms_completeButtonText="Save Enquiry" app:ms_stepperLayoutTheme="?ms_stepperStyle" app:layout_behavior="@string/appbar_scrolling_view_behavior" />

if i add theme attribute to StepperLayout it crashes and gives me the error below:

layout/ms_stepper_layout: Binary XML file line 49: You must supply a layout_width attribute

Please Help

@kevintorch kevintorch changed the title Having Issue on setting style on StepperLayout Having Issue applying style on StepperLayout Jan 31, 2020
@zawadz88
Copy link
Contributor

zawadz88 commented Feb 3, 2020

Hi,
It seems that you've mixed styles and themes a bit in here. ms_stepperStyle is used to set a global style in the app. In the code you posted you're assigning a theme to it though:

<style name="StepperStyle" parent="MSDefaultStepperLayoutTheme">

if you want to set a theme you should use ms_stepperLayoutTheme instead.
I can see that you're setting via app:ms_stepperLayoutTheme="?ms_stepperStyle" so the one in AppTheme.Default should not be needed.

For a sample usage see: https://github.com/stepstone-tech/android-material-stepper/blob/master/sample/src/main/res/values/styles.xml
AppThemeDark -> CustomStepperLayoutThemeSample -> DarkCustomStepperLayoutTheme

https://github.com/stepstone-tech/android-material-stepper#custom-styling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants