Java ExpandableListView.setOnClickListener工作不正常 我的设置
我有一个自定义ExpandableListAdapter,它扩展了BaseExpandableListAdapter,在其中我重写了isChildSelectable方法并返回true: 在片段类中重写的onCreateView方法中,我将通过以下方式设置onChildClickListener:Java ExpandableListView.setOnClickListener工作不正常 我的设置,java,android,expandablelistview,expandablelistadapter,Java,Android,Expandablelistview,Expandablelistadapter,我有一个自定义ExpandableListAdapter,它扩展了BaseExpandableListAdapter,在其中我重写了isChildSelectable方法并返回true: 在片段类中重写的onCreateView方法中,我将通过以下方式设置onChildClickListener: expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Over
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
try {
DownloadThisPatientInfo.downloadThisPatientInfo(...);
return true;
} catch (NullPointerException e) {
return false;
}
}
});
我的问题
未调用onChildClick方法中的代码
我尝试检测问题的内容
首先:Logcat没有显示错误,程序只是在单击一个子项后继续执行,就好像我没有单击它一样。没有错误,没有警告,什么都没有
我尝试设置一个断点,然后进入调试模式。行中的断点:
try {
子项单击后未触发此断点。以防万一,我在try块之前尝试调用Log.dstr、str:
日志中没有显示任何内容
显然,onChildClick中的代码没有被调用。我相信这一定是很明显的事情。为什么会这样?如果有必要,我将使用更多代码进行更新。已解决。考虑添加Android:DexEntAdvAdvals= BuffsS后代到您的项目的父线性布局。< /P>我添加到我的父LinearLayout的我的项目布局文件,但没有帮助:
try {
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Log.d("TESTING", "### Child Clicked.");
try { ... }
catch ( ... ) { ... }
});