有关 Android 列表项设计的建议

Suggestions regarding Android list item design

提问人:Ionut Ciuta 提问时间:9/23/2015 最后编辑:RamiIonut Ciuta 更新时间:9/23/2015 访问量:2582

问:

因此,我需要我的应用中的物品列表,并且我希望物品布局与 android material design 指南中显示的布局相似。我搜索了很多,但没有找到重新创建三行列表示例的方法:

我不想复制它,我只需要一些关于如何创建与部分分隔符和圆形图像视图类似的东西的指南。

我猜他们正在使用,对吧?RecyclerView

您会推荐我哪个图书馆的圆形图像视图?我以前用过这个,但也许有一些更好的选择。

Android 列表视图 android-recycler查看 android-design-library

评论


答:

3赞 Marko 9/23/2015 #1

将 或 与自定义适配器一起使用。ListViewRecyclerView

你的row.xml应该看起来像这样(只需添加一些填充,粗体,...)。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_download_cloud_green"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="One"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Two"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Three"/>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/grey"/>

    </LinearLayout>

</LinearLayout>

请务必在 ListView/RecyclerView 上禁用分隔符,因为它位于您的行中。

此外,将 CircleImageView 库用于 CircleImageView 是正确的做法(至少据我所知)。以前使用过同一个库,这太棒了!

评论

0赞 Ionut Ciuta 9/23/2015
谢谢!最后一个视图是我需要的。我将继续使用该库。
0赞 golkarm 9/7/2021
事实并非如此。在此示例中,第二部分只是一个文本视图,其中包含一些粗体文本和一些普通文本,但您使用了三个不同的文本视图。