android - ExpandableListView 和 getItemViewType

标签 android expandablelistview expandablelistadapter

ExpandableListAdapter 是否支持 BaseAdapter 重写 getItemViewType 和 getViewTypeCount 等功能,我可以在

中创建各种 View 类型
getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)

谢谢

最佳答案

ExpandableListAdapter 没有,但它的子类 BaseExpandableListAdapter 可以。因此,其他子类 CursorTreeAdapter、ResourceCursorTreeAdapter、SimpleCursorTreeAdapter 和 SimpleExpandableListAdapter 也间接地这样做。

这些方法是:

    public int getChildType(final int groupPosition, final int childPosition)
    public int getChildTypeCount()

关于android - ExpandableListView 和 getItemViewType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10412018/

相关文章:

android - 自定义可扩展 ListView 的子行

android - 当我展开子行时,可展开 ListView 背景变为白色

android - 使 ExpandableListView 尊重项目边距和填充

android - 更新从 Activity 传递的对象不起作用

java - 数据库在导出的 apk 中不起作用?

android - 检测屏幕中的 fragment

android - Android 中的可扩展 ListView

android - 将 ExpandableListView 添加到包含其他元素的选项卡

android - 引用 fragment 父 Activity 的最佳做法?

Android Asynctasks,在 Activity 之间传递字符串