android - 在提供包含的不仅仅是 TextView 的组 View 时,如何保留 ExpandableListView 的默认列表项按下行为?

标签 android expandablelistview android-viewgroup

在提供不仅仅包含 TextView 的组 View 时,是否可以保留 ExpandableListView 的默认列表项按下行为。我指的行为是按下的项目将背景颜色更改为黄色。

每次我提供包含例如一个 TextView 和一个 Button,我失去了行为。

最佳答案

另一种选择是设置您的根 ViewGroup 以阻止 subview 的焦点。

例子: <LinearLayout ... android:descendantFocusability="blocksDescendants" />

关于android - 在提供包含的不仅仅是 TextView 的组 View 时,如何保留 ExpandableListView 的默认列表项按下行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4919063/

相关文章:

android - 在 ViewGroup 中包装 KeyboardView : java. lang.IllegalStateException:指定的子项已经有父项

android - IllegalArgumentException 参数必须是此 View 在 ViewGroup.offsetRectBetweenParentAndChild 处的后代

android - 布局 Inflater、ViewGroup 和 removeView()

android - 调用 notifyDataSetChanged 时强制 ExpandableListView 更新数据

android - 如何在可扩展 ListView 中保存复选框的状态 - Android

Android Arrays 内容无故更改

java - 从本地数据库获取记录并在 ListView 中显示 IllegalStateException :

android - LiveData “pass-by-reference”初始值

android - 访问原始联系人数据

PHP/MySQL : table not found on mobile