如何实现preference类卡一样的Andr​​oid系统设置 [英] How to achieve preference category cards like Android System Settings

查看:175
本文介绍了如何实现preference类卡一样的Andr​​oid系统设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道谷歌是如何实现的,在设置应用程序中的卡牌效果?

Anyone know how google achieved the card effect in the settings app?

在这里输入的形象描述

推荐答案

它可以用做LinearLayout中较小的布局。像这样的:

It can be done with LinearLayout with smaller layouts. Like this:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/wirelessNetworks"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:elevation="8dp"/>

        <LinearLayout
            android:id="@+id/device"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:elevation="8dp"/>
    </LinearLayout>
</ScrollView>

有没有必要使用RecyclerView因为每一行都是不同的,所以没有必要回收任何东西。

There's no need to use RecyclerView because each row is different, so there's no need to recycle anything.

这篇关于如何实现preference类卡一样的Andr​​oid系统设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆