Android:可扩展列表视图将组标题移动到子项左侧

时间:2014-08-06 07:19:31

标签: android expandablelistview

是否可以使用可扩展列表视图将组标题移动到子项的左侧?

父组1 儿童1.1
          孩子1.2

父组2  孩子2.1
           孩子2.2

我的XML文件:

Expandable_list_view_page.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<ExpandableListView
    android:id="@+id/expandableListView"
    android:layout_marginTop="5dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
/>

</LinearLayout>

parent.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="@android:color/holo_green_dark"
>

<TextView
    android:id="@+id/tvParentTitle1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="50dp"
    android:text="parent 1"
    android:textColor="@android:color/white"
/>

<TextView
    android:id="@+id/tvParentTitle2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="5dp"
    android:text="parent 2"
    android:textColor="@android:color/white"
/>

<TextView
    android:id="@+id/tvParentTitle3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="5dp"
    android:text="parent 3"
    android:textColor="@android:color/white"
/>
</LinearLayout>

Child.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
>

<TextView
    android:id="@+id/tvChildText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="child"
/>

</LinearLayout>

0 个答案:

没有答案