hamsterready / android-accordion-view

Simple ListView based Android AccordionView
163 stars 107 forks source link

Creation of more/less accordions #2

Open jt234 opened 12 years ago

jt234 commented 12 years ago

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

hamsterready commented 12 years ago

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,

jt234 commented 12 years ago

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

jt234 commented 12 years ago

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.

hamsterready commented 12 years ago

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 :)

mona2787 commented 11 years ago

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?

hamsterready commented 11 years ago

@mona2787 have a look at #4 maybe it will work in your case.

At the moment I have no time to add this - but should be doable... will try to fix it sooner or later.

mona2787 commented 11 years ago

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.