Closed randyarrowood closed 11 years ago
There was quite easy way to do it. Will check in the morning and let you know.
Thanks. Please let me know if you have something better than this mod to the onFinishInflate:
for (int i = 0; i < childCount; i++) {
wrappedChildren[i] = getView(inflater, i);
View header = getViewHeader(inflater, i);
View footer = getViewFooter(inflater);
final LinearLayout section = new LinearLayout(getContext());
section.setOrientation(LinearLayout.VERTICAL);
section.addView(header);
section.addView(wrappedChildren[i]);
wrappedChildren[i].setVisibility(GONE);
section.addView(footer);
sectionByChildId.put(children[i].getId(), section);
addView(section);
}
wrappedChildren[childCount-1].setVisibility(VISIBLE);
initialized = true;
So... sounds like there is no easy option at the moment. One need to have access to wrappedChildren[i] and at the moment there are no getters for that ;(
You could traverse what you get from getSectionById() and then find button and issue click().
See my last commit - now you can configure visibility by providing reference to int-array where each item represents visibility status of each section:
In main.xml:
accordion:section_visibility="@array/accordion_visibility"
In strings.xml:
<integer-array name="accordion_visibility">
<item>1</item>
<item>1</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>
what would you recommend as the easiest way to auto-collapse the sections in the accordion on launch?