如何更改滑块字体样式?

How to change slider font style?

我正在使用 material 滑块,我想更改 自定义字体滑块的 toast

谁能指导我 如何更改滑块的字体样式?

我的代码:

  <com.google.android.material.slider.Slider
                         android:theme="@style/ThemeOverlay.PrimaryPalette.Red"
                         style="@style/Widget.App.Slider"

                         android:id="@+id/sliderRadius"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:stepSize="1"
                         android:valueFrom="0"
                         android:valueTo="20" />



<style name="Widget.App.Slider" parent="Widget.MaterialComponents.Slider">
        <item name="android:textAppearance">@style/TextAppearance.App.Tooltip</item>
    </style>
    <style name="TextAppearance.App.Tooltip" parent="TextAppearance.MaterialComponents.Tooltip">
        <item name="android:textColor">@color/purple_500</item>
        <item name="fontFamily">@font/josefin_sans_semibold</item>
        <item name="android:fontFamily">@font/josefin_sans_semibold</item>
    </style>
 <style name="ThemeOverlay.PrimaryPalette.Red" parent="">
        <item name="colorPrimary">#e53935</item>
        <item name="colorPrimaryDark">#ab000d</item>
      <!--  <item name="android:textAppearance">@style/TextAppearance.App.Tooltip</item>-->
 </style>

implementation 'com.google.android.material:material:1.3.0'

您可以使用类似的东西:

       <com.google.android.material.slider.Slider
           style="@style/App.Slider"/>

与:

<style name="App.Slider" parent="@style/Widget.MaterialComponents.Slider">
    <item name="labelStyle">@style/App.Tooltip</item>
</style>

<style name="App.Tooltip" parent="Widget.MaterialComponents.Tooltip">
    <!-- background color of the Tooltip -->
    <item name="backgroundTint">@color/...</item>
    <!-- textAppearance of the Tooltip -->
    <item name="android:textAppearance">@style/TextAppearance.App.Tooltip</item>
</style>

<style name="TextAppearance.App.Tooltip" parent="TextAppearance.MaterialComponents.Tooltip">
    <item name="android:textColor">@color/....</item>
</style>