Handling fontFamily attribute
oldsport76 opened this issue · comments
I'm using Paris in my project for styling along with Epoxy. I want to style a TextView to be able to toggle its fontFamily depending on state. For example, in one state I'd like to set a style that sets the fontFamily to sans-serif-medium, and in another to sans-serif.
I define my style as follows:
<style name="IconTextRowLabel">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:textColor">@color/dark_indigo</item>
<item name="android:textSize">14sp</item>
<item name="android:layout_marginRight">24dp</item>
<item name="fontFamily">sans-serif-medium</item>
<item name="android:layout_gravity">center_vertical</item>
</style>
All the other attributes I set are propagated into the view, but the fontFamily seems to remain at its sans-serif default setting. Does Paris support styling the fontFamily?
I googled and found this PR https://github.com/airbnb/paris/pull/60/files/a8d41212a3bc6a26a2a491e8fadaba24228eb939
Is there something I'm missing?
@oldsport76 it's supposed to be supported, yes. Have you tried using the android:
prefix, as in <item name="android:fontFamily" …
?
That was exactly it. Android Studio was auto-suggesting fontFamily
without the android:
prefix as I typed in the item rows. I seem to have completely overlooked this.Thanks!