Android DialogPreference中的ExpandableListAdapter

Android DialogPreference中的ExpandableListAdapter,android,android-layout,expandablelistview,expandablelistadapter,Android,Android Layout,Expandablelistview,Expandablelistadapter,我正在尝试将ExpandableListAdapter添加到DialogPrefence 我的布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/channels_list" android:layout_width="fill_parent" android:layout_height="fill_parent" andro

我正在尝试将ExpandableListAdapter添加到DialogPrefence

我的布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/channels_list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
    android:orientation="horizontal" >
    <LinearLayout
        android:id="@+id/channelsProgress"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:orientation="vertical"
        android:visibility="gone" >

        <ProgressBar
            android:id="@+id/pbChannelsProgress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:descendantFocusability="beforeDescendants" >
        </ProgressBar>
    </LinearLayout>
    <ExpandableListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         >
    </ExpandableListView>

</LinearLayout>
我必须如何使用ExpandableListAdapter

ExampleReallySimpleExpandableListAdapter adapter = new ExampleReallySimpleExpandableListAdapter(ctx, groupData, childData);
AbsListView lv = (AbsListView) vw.findViewById(R.id.list);
lv.setAdapter(adapter);
这导致:

03-25 14:24:23.780: E/AndroidRuntime(22187): FATAL EXCEPTION: main
03-25 14:24:23.780: E/AndroidRuntime(22187): java.lang.ClassCastException: com.example.tvrplayer.ExampleReallySimpleExpandableListAdapter cannot be cast to android.widget.ListAdapter
ExpandableListView
调用
setAdapter(ExpandableListAdapter)
,而不是从
AbsListView
调用通用
setAdapter(ListAdapter)

也就是说,改变

AbsListView lv = (AbsListView) vw.findViewById(R.id.list);


你知道一个人是否可以默认扩展它们吗?@Harry,你是什么意思?在默认情况下要展开的组上调用
expandGroup()
AbsListView lv = (AbsListView) vw.findViewById(R.id.list);
ExpandableListView lv = (ExpandableListView) vw.findViewById(R.id.list);