- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我目前正在做一个项目,我需要以下内容:
- MainGroup 1 (Expandable)
- SubGroup 1 (Expandable)
- SubSubGroup 1 (Expandable)
- Child View
- Child View
- ...
- SubSubGroup 2 (Expandable)
- Child View
- Child View
- ...
- SubGroup 2 (Expandable)
- SubSubGroup 3 (Expandable)
- Child View
- ...
- SubSubGroup 4 (Expandable)
- Child View
- ...
- SubGroup 3 (Expandable)
- Child View
- ...
- MainGroup 2 (Expandable)
- ...
最多只能是 ExpandableListView
在 ExpandableListView
内在 ExpandableListView
内- 所以3层ExpandableListView
:
MainGroup
只会持有其他ExpandableListView
.SubGroup
将持有其他ExpandableListView
除了最后两个,它们总是 ChildViews
. (我认为这两个可以用 SubSubGroup
的一个代替)SubSubGroup
会一直持有ChildViews
.我的问题是我认为我无法理解 ExpandableListView
的基本原理。布局它的 child 。我看过像 this 这样的例子,但无法理解该功能。
我试过简单地添加一个 ExpandableListView
作为另一个 child 的 child -但某些东西不能仅作为内部ExpandableListView
的第一项工作如果您展开其中一个外部组,则可见。但是,我可以通过手动设置外部组容器的高度使其足够大以显示内部 ExpandableListView
中的所有项目.为了达到最佳效果,当然应该即时计算高度。
所以,要解决一些更具体的问题:
ExpandableListView
“生命周期”(我的意思是实例化、 View 的重用、展开/折叠监听器)包括:
ExpandableListView
的方式和时间通知 child 展开/折叠?ExpandableListView
怎么样?知道要为所有 child 腾出多少空间才能放入一个团体容器吗?ExpandableListView
有多少好处?与使用一些 LinearLayouts
将我自己的解决方案混合在一起相比,创建上述内容还有一些 OnClickListeners
?编辑
对于我的最后一个问题,我可能会注意到可以有 1 到 20+ MainGroups
.
最佳答案
首先,让我推荐你GrepCode地点。它有 Android SDK 类的来源。感谢他们,我已经找到了 AdapterViews 的基本原理(我给了你一个 ExpandableListView 的链接,但如果你不仅研究它,而且研究它的类父项会更好)。
现在,你的问题和我的答案:
How and when is an ExpandableListView notified that a child is expanded/collapsed?
见方法handleItemClick(View v, int position, long id)
How does the ExpandableListView know how much space to make for all children to fit into a group container?
这个问题我没有好好研究,但据我所知,它是由requestLayout()方法做出来的。我们还发现一个可 ScrollView 不能嵌入到另一个可 ScrollView 中。 (这是众所周知的错误:将 ListView 放入 ScrollView 或将 ListView 放入 ExpandableListView)。
How much benefit is there in using the ExpandableListView to create the above, compared to just mixing together my own solution using some LinearLayouts and some OnClickListeners?
AdapterView 更快。但是即使对于 ExpandableListView,您的构造也太复杂了。您可以使用 2 种解决方案。
关于android - 多层ExpandableListView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8293538/
我只是想知道Mvvmmcross框架中是否潜藏着ExpandableListViews或与之相似的功能,还是这种控件不适用于多平台要求。 的功能在 http://deapsquatter.blogsp
我想知道是否可以将一个 ExpandableListView 作为另一个 ExpandableListView 的一个元素的一个子元素。谢谢 最佳答案 是的。可以在可扩展 ListView 中创建可扩
现在我想使用 ExpandableListView 来显示我的数据,我想更改项目左侧的图标或让它消失。有人可以给我一个建议吗。 谢谢。 最佳答案 setGroupIndicator(null) 应该让
我在 expandablelistview 子项目中有一个 edittext。然后,我在这个 edittext 中输入了一个文本,但是每当我点击其他 expandablelistview 标题时,我输
我正在尝试弄清楚如何构建包含(许多)的 View : PARENT1(可勾选、可扩展) CHILD1(单选按钮) CHILD2(单选按钮) ... PARENT2(可勾选、可扩展) CHILD1(可检
所以我刚刚进入了 ExpandableListView 领域,并希望在 DrawerLayout 中制作一个只有一组和 3 个 child 的简单列表 这是我的适配器代码: public cl
我是 Android 开发新手。我关注了this显示 ExpandableListView 及其正常工作的教程。如果我按所有组,那么所有组都会展开。 我一次只想扩展一组。一开始,第一个组将自动展开,如
我是 Android 新手。我想创建一个可扩展的 ListView,其中 1 行具有必须在 manin 线程中指定的自定义信息,而不是在布局中进行硬编码。 我想要一个图像和 2 个 TextView
我的应用程序中有一个 ExpandableListView。我想让子布局比组标题窄一点,并保持居中。由于一些视觉效果,我必须从代码中设置布局参数,但是我似乎找不到最好的解决方案,尝试从 xml 更
我正在将 JSON 解析为 ExpandableListView,在每个子项上,用户可以选择他想要拥有的 +/- 按钮的每个子项的数量。 +/- 按钮连接到 TextView,其中显示每个子项的总金额
我希望我的团队能够在第一时间扩大。然后它应该像往常一样运行(单击指示器后折叠/展开) 我找不到解决此问题的任何有效解决方案。 最佳答案 循环遍历所有组并使用expandGroup()您的 Expand
我正在编写一个 Android 应用程序,我决定使用可扩展 ListView 。我拥有所需的一切,列表工作正常,但是当我填充它时,组的顺序似乎与应有的顺序不同,这是一个示例: 如您所见,子值很好,只有
我在组项目的 ExpandableListView 中添加了 EditText,之后当我单击组项目时,不会出现包含子项目的列表。可能是什么问题?在这种情况下,这个列表是否可以扩展?或者禁止在Expan
当我单击组 View 时,可扩展列表的顺序会发生变化 我发现有人有类似的问题 here 顺序似乎是随机的,我不明白发生了什么。 这是我的代码,我知道它很乱,我已经重写了很多次。 public clas
我是 Android 编程的新手,我一直在思考如何做到这一点……我想创建一个 ExpandableListView,其中包含相同的子项 XML(包含添加、编辑和删除按钮)填充在所有组项目中。 有人可以
我在 Android 抽屉导航中使用 ExpandableListsViews 而不是菜单。而 OnExpandlistner 我正在改变背景颜色。前两个项目表现正常,它们的背景颜色发生了变化。但最后
我对 ExpandableListView 有疑问:在我的应用程序中,我使用了 ExpandableListView 并用我的适配器填充它“类 MyExpandableListAdapter 扩展了
我正在使用 Fedor 的适配器和图像加载器将图像延迟加载到可扩展 ListView 中。 ( Lazy load of images in ListView ) 它运行良好,但有一个问题。仅当 Im
关注this教程我能够制作一个大致这样布局的 View : Group1 child1 child2 group2 child1 child2 但是我想要更多的嵌套: grou
Blockquote 我在 android 中使用 ExpandableListView 这是适配器类中getChildView的代码: @Override public View g
我是一名优秀的程序员,十分优秀!