Android设置首选项类别的背景颜色

问题描述 投票:4回答:1

我尝试自定义首选项类别的背景颜色。我已经改变了首选项本身的背景颜色,但我找不到如何更改类别背景颜色的方法。

我找到了两种方法,但它们对我不起作用:changing the preference category label color background

通过this link,我找到了this,但我尝试过的任何东西都没有。这些布局片段是我到目前为止尝试过的:

<resources>
    <style name="setBackgroundTheme" parent="android:Theme">
        <item name="android:background">@color/darkbluelogo</item>
    </style>
</resources>

onCreate方法中,我将主题设置为:

setTheme(R.style.setBackgroundTheme);
android background-color preferenceactivity
1个回答
8
投票

使用背景颜色自定义布局文件,将其设置在PreferenceCategory中:

<PreferenceCategory
    android:layout="@layout/your_layout">
© www.soinside.com 2019 - 2024. All rights reserved.