【问题标题】:Android set background color of preference categoryAndroid设置偏好类别的背景颜色
【发布时间】:2012-05-19 18:37:34
【问题描述】:

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

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

通过this link,我找到了this,但我没有尝试过任何对我有用的方法。这些布局 sn-p 是我迄今为止尝试过的:

<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】:

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

    <PreferenceCategory
        android:layout="@layout/your_layout">
    

    【讨论】:

      猜你喜欢
      • 2011-10-26
      • 2013-08-04
      • 2016-09-01
      • 2012-07-31
      • 1970-01-01
      • 2019-07-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多