android - 像知乎设置页这样的列表样式是怎么实现的?
高洛峰
高洛峰 2017-04-17 18:01:10
0
3
710

从这两大部分的阴影样式来看,感觉像是用了两个cardview,一个包含了上面「我的草稿,最近浏览。。等等条目」,另一个包含了「夜间模式」和「设置」,是这样吗?还是说整体就是一个RecyclerView?

另外,item之间的分割线是怎么做的?谢谢

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all (3)
Peter_Zhu

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

    PHPzhong

    All pages that look like preference settings can be implemented using the following Fragment:

    1. android.preference.PreferenceFragment, used in native environment

    2. 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:

    1. [Night Mode], [Settings] is just aPreference

    2. [Night Mode] The above divider is aPreferenceCategory

    3. with no content set
    4. 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.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!