【问题标题】:custom design ui a listview in android在android中定制设计ui一个listview
【发布时间】:2021-09-02 23:44:11
【问题描述】:

我的项目中有一个 ListView 。如何根据下图自定义设计(每行和下一行之间必须存在间隙或空格,并且每行的颜色必须因 ListView 的背景而异)


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">



    <ListView
        android:id="@+id/hadis_lsv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
    </ListView>


</RelativeLayout>

【问题讨论】:

  • 可以向我们展示您的尝试吗?
  • 您应该更改 row_layout 中每一行的颜色,对于“gap”或“space”,您只需在 row_layout 中指定一个边距。

标签: android xml user-interface


【解决方案1】:

您应该为您的 RelativeLayout 提供填充或为 ListView 提供边距,以解决 Listview 之间的间隙或空间。

对于后台更改,请在 recyclerview 中绑定两个 ListView。然后在你的 onBindView 上设置一个条件来绑定特定的 ListView。

【讨论】:

    猜你喜欢
    • 2015-05-23
    • 1970-01-01
    • 2019-06-11
    • 2015-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-05
    • 1970-01-01
    相关资源
    最近更新 更多