【问题标题】:Suggestions regarding Android list item design关于Android列表项设计的建议
【发布时间】:2015-12-20 15:38:18
【问题描述】:

所以,我需要在我的应用程序中列出项目,并且我希望项目布局类似于 android 材料设计指南中提供的那些。我进行了很多搜索,但没有找到重新创建 三行列表 示例的方法:

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

我猜他们使用的是RecyclerView,对吧?

对于圆形图像视图,您会推荐我什么库?我用过this one before,但也许有更好的选择。

【问题讨论】:

    标签: android listview android-recyclerview android-design-library


    【解决方案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 库是正确的做法(至少据我所知)。以前用过同一个库,太棒了!

    【讨论】:

    • 谢谢!最后一个 View 正是我所需要的。我将继续使用该库。
    • 不是这样的。在示例中,第二部分只是一个文本视图,其中包含一些粗体文本和一些普通文本,但您使用了三种不同的文本视图。
    猜你喜欢
    • 2016-06-16
    • 1970-01-01
    • 2013-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-09
    • 2014-03-30
    相关资源
    最近更新 更多