草庐IT

expandablelistadapter

全部标签

android - 在 CursorTreeAdapter 类的 getChildrenCursor() 方法中异步查询数据库的模式

我已经为我从CursorTreeAdapter扩展的ExpandableListView实现了自定义适配器类(class)。一切都按预期工作。但我想知道在getChildrenCursor()中是否存在关于如何异步查询数据库的模式或某种最佳实践适配器类的方法。目前我正在将我的SQLiteOpenHelper类传递给我的适配器的构造函数并在getChildrenCursor()中使用它在UI线程上同步查询数据库。 最佳答案 您也可以使用CursorLoader而不是AsyncTask的子类来异步查询提供者。publicLoaderon

Android 可扩展 ListView : set background color of selected item on click

当用户点击我的expandableListView中的子项目时,我试图为项目设置背景颜色。代码如下:expListView.setOnChildClickListener(newOnChildClickListener(){@OverridepublicbooleanonChildClick(ExpandableListViewparent,Viewv,finalintgroupPosition,finalintchildPosition,longid){AlertDialog.Builderbuilder=newAlertDialog.Builder(New_annonce_act_

android - ExpandableListView 中的 EditText - 打开软键盘时保持焦点

我有一个包含多个组的ExpandableList,每个组都包含一个不同类型(不同布局)的子项。我有几个结构相似但subview不同的Activity,所以我决定为它编写一个自定义适配器。适配器在大多数情况下工作良好,除了几个问题:在subview中键入文本几乎是不可能的。在键入每个字符后,EditText似乎失去了焦点。我已附上屏幕截图来说明该行为。当组展开/折叠几次后,TextViews中的文本似乎消失了,每个View中只出现第一个单词的第一个字母。不知何故,它们的布局参数似乎以某种方式计算错误。截图如下:这是我的适配器的代码:publicclassGenericExpandable

android - ExpandableListAdapter.getChildView() 与 AbsListView.LayoutParams 的交互

我正在研究BaseExpandableListAdapter的扩展,并具有以下getChildView()的实现:publicViewgetChildView(intgroupPosition,intchildPosition,booleanisLastChild,ViewconvertView,ViewGroupparent){AbsListView.LayoutParamslp=newAbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,48);RelativeLayoutlayout=newRelativeLayo

java - 在 ExpandableListView 中,如何在子结果的末尾显示额外的一行?

我创建了一个自定义ExpandableListAdapter一切正常。我希望能够做的是在每个组的末尾添加不同类型的child。我尝试将1添加到getChildrenCount()数字,然后在getChildView()方法中测试isLastChild,但这似乎并没有工作。如果一个小组有三个child,我的工作看起来像这样:GroupNormalChildNormalChildNormalChild但我真的很喜欢这样的东西:GroupNormalChildNormalChildNormalChildAlternateChild想法是AlternateChild可以链接到有关组的更多信息。

java - ExpandableListAdapter.getChild() 出现 NullPointerException

卡在这里一个多星期了还是没解决!我有一个expandablelistView,其中的数据是从SQLite中检索的,并设置为expListAdapter。单击箭头后,它将显示两个子项目。添加每月费用publicclassAddMonthlyExpensesextendsAppCompatActivity{ArrayListgroupList=newArrayList();;ListchildList;Map>laptopCollection;ExpandableListViewlistview;ExpandableListAdapterexpListAdapter;@Overridepr

Android ExpandableListView长组点击监听防止展开

我在我的Android应用程序中使用ExpandableListView,如果用户长时间点击组元素,我想执行一个操作,所以我在我的中定义了一个OnLongClickListener>BaseExpandableListAdapter扩展。监听器按方面工作,但子元素不再展开。有什么想法吗?publicclassConnectionAdapterextendsBaseExpandableListAdapter{...publicViewgetGroupView(intgroupPosition,booleanisExpanded,ViewconvertView,ViewGroupparen

android - 在上下文操作栏可见时停止 ExpandableListView 组扩展

我有一个包含ExpandableListView的fragment。我希望能够按组选择和删除项目。我还希望能够通过上下文操作栏选择多个组项目进行删除。到目前为止,我可以点击groups查看children,也可以点击children转到另一个Activity。我将ExpandableListView的选择模式设置为CHOICE_MODE_MULTIPLE_MODAL,如果我在一个组上长按,它就会被选中,这是一个上下文操作栏出现。如果我选择我的删除按钮,该项目将被删除。都好。但是,当我尝试在CAB模式下选择多个组时,问题就出现了。它只是行不通。如果我单击第二个组,该组将展开(未选中)。我

android - 清除 ExpandableListView

我正在使用ExpandableListView和ViewPager,所以在onPageSelected()中我需要清除列表。我知道为ListView做的一种方法是setAdapter(null)但我得到ThemethodsetAdapter(ListAdapter)isambiguousforthetypeExpandableListView如果我在ExpandableListView上尝试它会出错。 最佳答案 尝试使用如下所示的BaseExpandableListAdapter类型转换null。listview.setAdapte

android - 如何在 scrollview android 中使用多个 expandablelistview?

我想在单屏设置3个expandablelistview我想添加多个expandablelistviewXmlLayout//thisismyscorllview我想在用户单击时一个一个地设置适配器我不知道如何设置多个expandableList?Java文件privateTestWellnessScoreBoardExpandableListAdaptermHealthaAdapter;privateTestWellnessScoreBoardExpandableListAdaptermChallengeAdapter;privateTestWellnessScoreBoardExpa