Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ExpandableListView是否可以嵌入到其他布局中?_Android_Android Layout_Expandablelistview_Expandablelistadapter - Fatal编程技术网

Android ExpandableListView是否可以嵌入到其他布局中?

Android ExpandableListView是否可以嵌入到其他布局中?,android,android-layout,expandablelistview,expandablelistadapter,Android,Android Layout,Expandablelistview,Expandablelistadapter,我希望在我的应用程序中有一个可扩展/可折叠的列表视图,类似于市场上每个应用程序的评论显示方式(事实上,列表中的每个项目都是与市场上相同格式的评论)。由于可能有许多列表项,我不希望用户丢失列表下方的按钮,并且用户可能对阅读列表中的项目不感兴趣,因此我希望此列表可以展开和折叠 我已经研究了扩展BaseExpandableListAdapter,它看起来非常整洁,除了列表似乎总是使用ExpandableListActivity显示。我想在用户已经看到的页面中嵌入列表 有人知道使用BaseExpanda

我希望在我的应用程序中有一个可扩展/可折叠的列表视图,类似于市场上每个应用程序的评论显示方式(事实上,列表中的每个项目都是与市场上相同格式的评论)。由于可能有许多列表项,我不希望用户丢失列表下方的按钮,并且用户可能对阅读列表中的项目不感兴趣,因此我希望此列表可以展开和折叠

我已经研究了扩展BaseExpandableListAdapter,它看起来非常整洁,除了列表似乎总是使用ExpandableListActivity显示。我想在用户已经看到的页面中嵌入列表

有人知道使用BaseExpandableListAdapter是否可以实现这一点,或者我是否必须使用一种不同的技术并自己编写所有样板代码

非常感谢,,
尼娜

当然。应该没有问题。ExpandableListActivity只是
ExpandableListView
上的一层薄薄的饰面(实际上,任何布局都有
ExpandableListView
,id为
android.R.id.list
。您可以将
ExpandableListActivity
与您自己的自定义布局一起使用,也可以定义您自己的活动并放弃该布局(相对较少)ExpandableListActivity提供的方便方法。

当然。应该没有问题。ExpandableListActivity只是
ExpandableListView
(实际上,任何具有id为
android.R.id.list
ExpandableListView
的布局。您可以将
ExpandableListActivity
与自己的自定义布局一起使用,也可以定义自己的活动并放弃(相对较少)
ExpandableListActivity
提供的方便方法。

是的,使用
ListView
ExpandableListView
和没有相关活动的朋友并不困难

在实例化它或从布局中检索它之后,只需在
ExpandableListView
上调用
setAdapter()

ExpandableListView list = (ExpandableListView) findViewById(R.id.listView);
list.setAdapter(myExpandableAdapter);

是的,在没有相关活动的情况下使用
列表视图
可扩展列表视图
和好友并不困难

在实例化它或从布局中检索它之后,只需在
ExpandableListView
上调用
setAdapter()

ExpandableListView list = (ExpandableListView) findViewById(R.id.listView);
list.setAdapter(myExpandableAdapter);

非常感谢,现在我知道怎么做了。我没有看到任何关于如何做的例子,但现在它工作得很好。非常感谢,现在我知道怎么做了。我没有看到任何关于如何做的例子,但现在它工作得很好。谢谢你的回复,但我需要更具体的东西。谢谢你的回复,但我需要更具体的东西网。