Using a theme for preferences screen

后端 未结 1 540
独厮守ぢ
独厮守ぢ 2021-01-31 12:13

I want the change the look of the preferences screen for an app I am working on. On some phones the preferences are very translucent and it is quite difficult to read the prefe

相关标签:
1条回答
  • 2021-01-31 12:59

    The basic things are:

    1. A theme for your preferences activity which defines styles for the preference widgets and other things. Take a look at the first theme in themes.xml - this defines the window background, text styles and the preference styles (preferenceScreenStyle, preferenceCategoryStyle etc)
    2. Some styles for each of the preference widgets (which are referenced in themes.xml). For instance in styles.xml they define the Preference.Category and Preference.PreferenceScreen styles.
    3. Apply the theme to your Activity. In your manifest change your opening activity tag for your preferences activity to <activity android:theme="@style/CustomTheme"...

    If you want to inherit the default Android styles and then just override some of them, then add parent="@android:style/Theme" to the opening <style... tag of your theme.

    Take a look at Applying Styles and Themes for more info.

    0 讨论(0)
提交回复
热议问题