Is it possible to place 2 horizontal bars in a expandable list view?
As per my project requirement i need to place 2 horizontal bars in a expandable view. my question is that "is it possible to create a bar chart inside 开发者_如何转开发expandable list view?" If possible, Can any one please give me a suggestion how to put a bar chart in a expandable list with an example.
Thanks in advance.
That's not a problem. You can back the data of an expandable list using an adapter:
YourAdapter implements ExpandableListAdapter
and connecting this adapter to your list:
yourList.setAdapter(YourAdapter)
Now, the ExpandableListAdapter Interface gives you some methods which you will have to implement. The most interesting regarding your question are:
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
and
getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
Using those methods, Android basically asks you what those GroupViews and ChildViews (those are the ones that become visible when you click a groupView) should look like. You can return any View you like: Create one or you can load one from XML. When you're done, simply return it & Android will do the rest.
I Hope that helps you.
精彩评论