Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
280 views
in Technique[技术] by (71.8m points)

java - Divider between items in expandableListView when its opened

how to set a divider under item in opened group? i have 4 groups, and a lot of items in the groups, i need to set a bottom divider to all items. Im trying to write android:divider="orange" and android:dividerHeight="2dp to code, but doesnt work.

<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>
question from:https://stackoverflow.com/questions/65679958/divider-between-items-in-expandablelistview-when-its-opened

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...