Comments (5)
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.
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.
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.
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.
Thank you very much! Did not pay attention(
from animatedexpandablelistview.
Related Issues (20)
- Issue while expading Last group item
- Expand the group to the top of the screen. HOT 1
- Spinner within child of ExpandableListView
- How to change Positon of Arrow?
- Bad group view recycling HOT 1
- Change Color of GroupItem and ListDivider
- Need help for less collapsed items
- Dividers disappearing after animation
- No animation when expanding HOT 2
- collapse otherviews HOT 1
- checkbox inside childview
- When add divider space, top of child views cut off when animating
- Last group not clickable when you insert a footer. Jelly Bean version
- My childitems not shown HOT 1
- SearchView
- duplicate childe view HOT 1
- 最后一个条目在屏幕最下方的时候有问题
- can it be customed to show 3 or some fixed number item (some)when collapsed
- Collaps or Expand randomy stop for some group
- Going 3 levels deep
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animatedexpandablelistview.