Creation of more/less accordions
jt234 opened this issue · 7 comments
The number of accordion views is locked to the amount of elements you have in the string array labelled accordion_sections.
To give the developer more flexibility it could be ideal to remove this connection from the string array as I have done.
I was just wondering if there would be any problem in doing this.
My first thought may be a problem with the value returned by getChildCount().
Any thoughts/ideas wouldn't go unnoticed,
Cheers,
jt234
Hi jt234,
Thanks for this, need to have a look but it should be fairly simple to be allowed to add more sections in runtime. Recently I added some methods to be allowed to hide sections so maybe that's a temporary options for you (create all what you need, then hide and show on demand).
Cheers,
Hi hamsterready,
I think it would be a nice feature to be able to have the ability, as you have stated, to add more accordion sections programmatically.
I might have a go at creating the encasing <com.sentaca.android.accordion.widget.AccordionView ... > </com.sentaca.android.accordion.widget.AccordionView> programmatically (although I highly doubt this will work, in fact I know it wont) just to see if I can get it to work.
But when it comes to it, I think that the use of your hidden sections will have to be a temporary fix for me.
Thanks for your quick feedback.
Cheers,
jt234
After a bit of research and working code I have found that it is more idealistic to utilize the android ExpandableListView. You would be able to create an accordion type view while also being able to create/remove accordion elements programmatically.
Hi jt234,
First version was based on ListView but I have hit some major issues with passing events to ui components added to this kind of accordion. Possibly was doing something wrong :)
i have to create a dynamic Accordian, means each time when accordian will shown it has different number of section.
how could i do it?
Thanks hamsterready,
my problem has been solved.
SharedPreferences savedSession = context.getSharedPreferences(Claims_Section, Context.MODE_PRIVATE);
String sectionArr=savedSession.getString(SECTION_ARRAY,"") ;
sectionHeaders=sectionArr.split("\\^");
//sectionHeaders = getResources().getStringArray(sectionHeadersResourceId);
and modified the children layout .
thanks a lot for such a wonderful code.