在 expandableListView 打开时,项目之间的分隔线

问题描述

如何在打开的组中的项目下设置分隔符? 我有 4 个组,组中有很多项目,我需要为所有项目设置一个底部分隔线。 我正在尝试编写 android:divider="orange"android:dividerHeight="2dp 编码,但不起作用。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context=".MainActivity"
    >

    <TextView
        android:id="@+id/Header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="gray"
        android:dividerHeight="20dp"
        android:fontFamily="@font/sourcesanspro_bold"
        android:padding="10dp"
        android:text="keyconfig"
        android:textAlignment="viewStart"
        android:textColor="gray"
        android:textSize="20sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ExpandableListView
        android:id="@+id/lvExp"
        android:layout_width="match_parent"
        android:divider="orange"
        android:dividerHeight="2dp"
        android:layout_height="match_parent"
        android:layout_below="@+id/Header"
        android:layout_alignParentBottom="false" >

    </ExpandableListView>


</RelativeLayout>


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="55dip"
    android:orientation="vertical"
    android:divider="orange"
    android:dividerHeight="2dp"
    android:background="#d2d4d5 ">

    <TextView
        android:id="@+id/lblListItem"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="18dp"
        android:textColor="gray"
        android:background="#d2d4d5 "
        android:divider="orange"
        android:dividerHeight="2dp"
        android:layout_margin="9dp">

    </TextView>
</LinearLayout>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...