Frage


getChildView is not be called for last item !!! , for rest of the items it working fine . (In most of my case i will have 2 parents and with each parent having one child) .

public class PDPContentAdapter extends BaseExpandableListAdapter {

    private Context context;
    private List<String> groupList;
    private List<List<String>> childList;
    private boolean isTSV;

    public PDPContentAdapter(Context context, List<String> groupList, List<List<String>> childList, boolean isTSV) {
        this.context = context;
        this.groupList = groupList;
        this.childList = childList;
        this.isTSV = isTSV;
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return ((List<String>)childList.get(groupPosition)).get(childPosition);
    }

    @Override
    public long getChildId(int groupPosition, int childPosition) {
        return 0;
    }

    @Override
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        String content = ((List<String>) childList.get(groupPosition)).get(childPosition);
        Log.e("PDPContent Adapater", groupPosition +"-------"+childPosition);




            WebView webView = new WebView(context);
            webView.loadData("Hello", "text/html",null);        
            return webView;

    }

    @Override
    public int getChildrenCount(int groupPosition) {
        return childList.get(groupPosition).size();
    }

    @Override
    public Object getGroup(int groupPosition) {
        return groupList.get(groupPosition);
    }

    @Override
    public int getGroupCount() {
        return groupList.size();
    }

    @Override
    public long getGroupId(int arg0) {
        return arg0;
    }

    @Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        TextView view = new TextView(context);
        if(isExpanded)
            view.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.pdp_collapse, 0);
        else
            view.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.pdp_expand, 0);
        view.setText(groupList.get(groupPosition));
        return view;
    }

    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public boolean isChildSelectable(int arg0, int arg1) {
        return true;
    }
}
War es hilfreich?

Lösung


Solution to my problem is i have added a dummy footer to my expandableListView . Don't know the reason but after that it working fine .

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top