Skip to content

Styling the fragments

maltaisn edited this page Oct 19, 2019 · 1 revision

Many attributes are provided to style the fragments views and theme.

Changing an attribute

You can change attribute in your app's styles.xml

<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <item name="recurrencePickerStyle">@style/RecurrencePickerStyleCustom</item>
</style>

<!-- Recurrence picker theme -->
<style name="RecurrencePickerStyleCustom" parent="RecurrencePickerStyle">
    <!-- You can customize the recurrence picker style here -->
    <!-- This line changes the text appearance of subtitle text views -->
    <item name="rpPickerSubtitleTextAppearance">@style/MySubtitleTextAppearance</item>
</style>

<style name="MySubtitleTextAppearance" parent="RpPickerSubtitleTextAppearance">
    <!-- Don't forget to specify the parent! -->
    <item name="android:allCaps">true</item>
</style>

Parent style name is always the same as the attribute name but starts with a capital letter. It's important to specify the parent, because the parent style might define some attributes that you don't.

Available attributes

General

  • rpTextAppearance: Body text appearance used for most labels.
  • rpToolbarThemeOverlay: Toolbar theme overlay used in picker fragment.

Recurrence list dialog

  • rpListStyle: Style of the recurrence list RecyclerView.
  • rpListItemStyle: Style of a list item layout (a FrameLayout).
  • rpListItemLabelStyle: Style of a list item label (a RadioButton).

Recurrence picker dialog/fragment

  • rpPickerDividerStyle: Style for the dividers.
  • rpPickerSubtitleTextAppearance: Style for the subtitles.
  • rpPickerInputLayoutStyle: Style for the number inputs (TextInputLayout).
  • rpPickerInputStyle: Style for the number inputs (TextInputEditText).
  • rpPickerDropdownLayoutStyle: Style for the dropdown layouts (TextInputLayout).
  • rpPickerDropdownStyle: Style for the dropdowns (TextInputEditText).
  • rpPickerWeekBtnStyle: Style for a day of week button in RecurrencePickerFragment (ToggleButton).
  • rpPickerDialogWeekBtnStyle: Style for a day of week button in RecurrencePickerDialog (ToggleButton).
You can’t perform that action at this time.