小编And*_*rta的帖子

ExpandableListAdapter onClickListener,调用notifyDataSetChanged()

我有一个使用onclickListener来更改父文本的自定义适配器,我无法弄清楚如何让notifyDataSetChanged方法在适配器中工作.

应该发生的是我有一个可扩展的视图,当你点击子视图中的按钮时,它会更新父视图中的父文件...

这是一个应该发生什么的图片示例.在点击按钮之前使用这个: 在此输入图像描述

然后单击按钮使用此: 在此输入图像描述

"选择一种成分"更改为"米饭,杯子"或点击的任何内容

所以在我显示的代码中,单击按钮后它应该更新它所执行的操作,然后刷新由于某种原因我不能做的视图?

继承我的代码,提前致谢!

    package com.example.andrew.mypantry;

import android.content.Context; 
import android.graphics.Typeface;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import org.w3c.dom.Text;

import java.util.HashMap;
import java.util.List;

/**
 * Created by andrew on 7/1/2015.
 */
public class IngExpandableListAdapter extends BaseExpandableListAdapter {

private Context context;
private List<String> listDataHeader; //header titles
//child data in format of <header title, child title>
private HashMap<String, List<String>> listDataChild;

public IngExpandableListAdapter(Context context, List<String> listDataHeader,
                                HashMap<String, List<String>> listDataChild) {
    this.context …
Run Code Online (Sandbox Code Playgroud)

android expandablelistview expandablelistadapter onclicklistener

13
推荐指数
1
解决办法
1305
查看次数