如何在Android中设置DialogFragments标题的样式?

时间:2018-11-29 19:51:30

标签: android android-fragments android-styles

我有一个带很多DialogFragments标题的Android应用。我想设置此对话框的标题的样式:更改字体及其重量,文本大小,颜色。为了在styles.xml中实现此目的,我添加了:

 <!-- Base theme. -->
<style name="BaseTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="android:fitsSystemWindows">true</item>
    <item name="android:dialogTheme">@style/AppDialogTheme</item>
</style>

<!-- App dialog theme. -->
<style name="AppDialogTheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="android:windowTitleStyle">@style/DialogWindowTitleText</item>
</style>

<style name="DialogWindowTitle" parent="Base.DialogWindowTitle.AppCompat">
    <item name="android:textAppearance">@style/DialogWindowTitleText</item>
</style>

<style name="DialogWindowTitleText" parent="@android:style/TextAppearance.DialogWindowTitle">
    <item name="android:textSize">18sp</item>
    <item name="android:textColor">@color/textColor</item>
    <item name="android:fontFamily">@font/proxima_nova_regular</item>
</style>

但是没有带来任何效果。有人可以帮助我,告诉我我哪里出问题了吗?

0 个答案:

没有答案