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

Theme level styling not working for me #14

Open
theapache64 opened this issue Feb 3, 2019 · 3 comments
Open

Theme level styling not working for me #14

theapache64 opened this issue Feb 3, 2019 · 3 comments

Comments

@theapache64
Copy link

theapache64 commented Feb 3, 2019

Hey, this might not be a library issue, but most probably mine.

I've set the fontAttr like this

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
       ...
        <item name="materialButtonStyle">@style/CustomButtonStyle</item>
    </style>

    <style name="CustomButtonStyle" parent="Widget.MaterialComponents.Button.OutlinedButton">
        <item name="fontPath">fonts/GoogleSans-Bold.ttf</item>
        <item name="android:textSize">50sp</item>
    </style>

but the font's not getting changed for the button, (textSize attr works).
(Note: If i set the fontPath attr directly to the widget,it works. but i want to do it via style.xml)
What am i doing wrong?

@jbruchanov
Copy link

+1

@hsson
Copy link

hsson commented Aug 19, 2020

Also having this issue! I'm using a default font specified as suggested in the README. But for buttons I have created a new style that uses the fontPath="fonts/my-other-font.tff" (not the same as the default font) attribute. For some reason the buttons still use the default font and not the font specified by fontPath.

Specifying the fontPath attribute directly on the element in the layout works, but not when specifying it in styles.xml

@hsson
Copy link

hsson commented Aug 19, 2020

I did some experimenting and found that if I specify the style directly on the element on the layout, the correct font is applied. But if I just rely on the materialButtonStyle in my theme and don't explicitly set the style on each button it doesn't work.

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

3 participants