如何在expandablelistview中为子视图设置分隔符高度

时间:2014-07-08 10:48:43

标签: android user-interface parent-child

如何在expandablelistview中为子视图和父视图设置不同的分隔符高度值

我的代码是

Expandablelistview.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >

<ExpandableListView
    android:id="@+id/left_drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="20dp"
    android:background="#000000"
    android:choiceMode="singleChoice"
    android:divider="@null"
    android:dividerHeight="3dp"
    android:footerDividersEnabled="true"
    android:padding="5dp"
    android:scrollbars="none" />

expandable_child.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical"
tools:context=".Main_Navigation" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="35dp"
    android:background="#E5E5E5"
    android:gravity="center_vertical"
    android:textColor="#000000" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:background="@drawable/border_two"
        android:padding="5dp"
        android:text="AAAAA"
        android:textSize="14sp" />
</LinearLayout>

Expandable_header.xml

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@drawable/fag_dropdown" (image)
android:gravity="center_vertical"
android:padding="5dp"
android:layout_marginTop="5dp"
android:textColor="#FFFFFF"
android:text="aaaaa"
android:textSize="15sp"

/>

border_two.xml

<?xml version="1.0" encoding="UTF-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
    android:width="1dp"
    android:color="#A4A4A4"/>
<corners
    android:bottomLeftRadius="0dp"
    android:bottomRightRadius="0dp"
    android:topLeftRadius="0dp"
    android:topRightRadius="0dp" />

那么,如何为标题和子标题设置不同的分隔符高度

1 个答案:

答案 0 :(得分:-1)

试试这个:android:dividerHeight="50dp"