【问题标题】:how to fix space in expandable list view in parent but not in child如何在父级而不是子级的可扩展列表视图中修复空间
【发布时间】:2017-07-24 10:57:28
【问题描述】:

我使用可展开的列表视图。我想显示父母之间的空间,但孩子还是一样。 我使用可展开的列表视图

  <ExpandableListView
        android:id="@+id/listviewExpandAble"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:dividerHeight="10dp"
        app:layout_constraintTop_toTopOf="parent"></ExpandableListView>

【问题讨论】:

    标签: android listview expandablelistview


    【解决方案1】:
    Try this code:- 
    
     <ExpandableListView
            android:id="@+id/eventplanning_list"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            android:childDivider="@color/child_divider_color"
            android:clipChildren="true"
            android:clipToPadding="true"
            android:divider="@color/child_divider_color"
            android:dividerHeight="0.5dp"
            android:groupIndicator="@null"
            android:paddingLeft="20dp"
            android:paddingRight="20dp"
            android:scrollIndicators="none"
            android:scrollbars="none"
            android:transitionGroup="true"/>
    

    【讨论】:

    • 你能告诉我它是如何工作的。我是一个新的开发者请
    • 为什么我们在 childDivider 中使用颜色
    • 将此代码添加到您的 XML 中,并在您的颜色文件中定义常量“child_divider_color”
    • 这只是可选的,如果您不想使用则忽略此行。从代码中排除这一行并运行。
    • 最后一个孩子和孩子下面的父母没有空间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-17
    相关资源
    最近更新 更多