Coder Social home page Coder Social logo

Comments (5)

idunnololz avatar idunnololz commented on September 25, 2024

Can you please post your expandablelistview structure (like layout for child and group views and how many types of child and or group views) ? Thanks

from animatedexpandablelistview.

idunnololz avatar idunnololz commented on September 25, 2024

If you are testing using vanilla Android then line 495 in the relative layout source is
if (mLayoutParams.height >= 0) {
Which must mean that the layout params of a Relative Layout is null.

from animatedexpandablelistview.

Collosteam avatar Collosteam commented on September 25, 2024

I'm used simple adapter
public class ExpListAdapter extends AnimatedExpandableListView.AnimatedExpandableListAdapter {

Context context;
ArrayList<String> groups;
ArrayList<ArrayList<String>> titles;

public ExpListAdapter(Context context, ArrayList<String> groups, ArrayList<ArrayList<String>> titles) {
    this.context = context;
    this.groups = groups;
    this.titles = titles;

}

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

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

@Override
public Object getChild(int groupPosition, int childPosition) {
    return titles.get(groupPosition).get(childPosition);
}

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

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

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

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.start_parent, null);
    }
      TextView textGroup = (TextView) convertView.findViewById(R.id.tv_parent_size);
    textGroup.setText(groups.get(groupPosition));
    TextView textGroupnum = (TextView) convertView.findViewById(R.id.tv_parent_numbet);
    textGroupnum.setText(String.valueOf(groupPosition + 1));
    return convertView;
}

@Override
public View getRealChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.start_childer, null);
    }
    TextView textChild = (TextView) convertView.findViewById(R.id.tv_children_name);
    textChild.setText(titles.get(groupPosition).get(childPosition));
    return convertView;
}
@Override
public int getRealChildrenCount(int groupPosition) {
    return titles.get(groupPosition).size();
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
    return true;
}

}

In my expandable list, I use one view type for group and and one for child view

In activie I'm use next code:
// In order to show animations, we need to use a custom click handler
// for our ExpandableListView.

    listView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            // We call collapseGroupWithAnimation(int) and
            // expandGroupWithAnimation(int) to animate group
            // expansion/collapse.
            if (listView.isGroupExpanded(groupPosition)) {
                listView.collapseGroupWithAnimation(groupPosition);
            } else {
                listView.expandGroupWithAnimation(groupPosition);
            }
            return true;
        }

    })

from animatedexpandablelistview.

idunnololz avatar idunnololz commented on September 25, 2024

Instead of using LayoutInflater.inflate(int layoutId, ViewGroup parent) try using LayoutInflater.inflate(int layoutId, ViewGroup root, boolean attachToRoot).

So replace inflater.inflate(R.layout.start_parent, null); with inflater.inflate(R.layout.start_parent, parent, false); and inflater.inflate(R.layout.start_childer, null); with inflater.inflate(R.layout.start_childer, parent, false);

from animatedexpandablelistview.

Collosteam avatar Collosteam commented on September 25, 2024

Thank you very much! Did not pay attention(

from animatedexpandablelistview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.