Because the number of these items is fixed and the number is small, you can write the entire list yourself. The copy style is actually the most efficient. The dividing line is actually a view with margin on the left. Set a background color. Height 1px
All pages that look like preference settings can be implemented using the following Fragment:
android.preference.PreferenceFragment, used in native environment
android.support.v7.preference.PreferenceFragmentCompat, for compatible environments
1, 2 have the same basic functions, except that 2 exists for compatibility with lower versions and was introduced in the latest version of support-v7. The list of 1 is implemented using ListView, and the list of 2 is implemented using RecyclerView. In addition, both of them have a set of Preferences, which are Item items in the list, which can meet various needs and can also be customized.
Specific ideas:
[Night Mode], [Settings] is just aPreference
[Night Mode] The above divider is aPreferenceCategory
with no content set
Write*prefs.xml according to your needs
The layout of p.s.Preference can be set by calling the interface or modifying themes.xml (style)
For linearlayout, there are showpiders. You can download it from Baidu or Google. It’s very convenient. You don’t need to write View as a dividing line.
Because the number of these items is fixed and the number is small, you can write the entire list yourself. The copy style is actually the most efficient. The dividing line is actually a view with margin on the left. Set a background color. Height 1px
All pages that look like preference settings can be implemented using the following Fragment:
android.preference.PreferenceFragment, used in native environment
android.support.v7.preference.PreferenceFragmentCompat, for compatible environments
1, 2 have the same basic functions, except that 2 exists for compatibility with lower versions and was introduced in the latest version of support-v7. The list of 1 is implemented using ListView, and the list of 2 is implemented using RecyclerView. In addition, both of them have a set of Preferences, which are Item items in the list, which can meet various needs and can also be customized.
Specific ideas:
[Night Mode], [Settings] is just aPreference
[Night Mode] The above divider is aPreferenceCategory
Write*prefs.xml according to your needs
The layout of p.s.Preference can be set by calling the interface or modifying themes.xml (style)
Specific usage:
Official Document: PreferenceFragment
p.s. For more usage, please Google it.
For linearlayout, there are showpiders. You can download it from Baidu or Google. It’s very convenient. You don’t need to write View as a dividing line.