1

在我的应用程序中,我提供了一个选项来应用样式来编辑活动的背景颜色。但是,如何添加额外的微调器选项来更改字体样式?我可以创建一个主题来涵盖背景和字体样式的每种组合,但是随着添加更多颜色或样式,这将变得笨拙。有没有人有任何指导?

<style name ="redBody">
         <item name="android:textColor">@color/red</item>
        <item name ="android:background">@color/white</item>
    </style>

    <style name ="redTitle">
         <item name="android:textColor">@color/white</item>
        <item name ="android:background">@color/red</item>
    </style>

    <style name ="blueBody">
         <item name="android:textColor">@color/darkBlue</item>
        <item name ="android:background">@color/white</item>
    </style>

    <style name ="blueTitle">
         <item name="android:textColor">@color/white</item>
        <item name ="android:background">@color/darkBlue</item>
    </style>

    <style name ="greenBody">
         <item name="android:textColor">@color/green</item>
        <item name ="android:background">@color/white</item>
    </style>

    <style name ="greenTitle">
         <item name="android:textColor">@color/white</item>
        <item name ="android:background">@color/green</item>
    </style>

    <style name = "Theme" parent="@android:style/Theme">
        </style>

    <style name = "Theme.Red" >
        <item name="textTitle">@style/redTitle</item>
        <item name="textBody">@style/redBody</item>

        </style>

    <style name = "Theme.Blue" >
        <item name="textTitle">@style/blueTitle</item>
        <item name="textBody">@style/blueBody</item>

        </style>
    <style name = "Theme.Green">
        <item name="textTitle">@style/greenTitle</item>
        <item name="textBody">@style/greenBody</item>

        </style>
4

0 回答 0