Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Custom Carousel component

    I'm planning to create my first custom component and that would be carousel component to achieve a functionality of this:

    http://sorgalla.com/projects/jcarousel/examples/static_simple.html

    Some pointers would be helpful regarding the existing components which could be used and tweaked etc.

    thanks.

    #2
    hi ,

    A sample algorithm may help u.

    1. Create image objects and add to an arraylist
    2. draw a hlayout
    2.1. add prev button
    2.2. hlayout where the images to be placed ,set the hlayout setanimate members() - for animation
    2.3. add next button
    2.4 set curved border for this layout
    2.5 set background image for this

    3. set the no:of images to be shown in each page..(in the example its 3)=pagecount
    then you find out the no:of pages by arraylist.size()/no:of images per page=noofPages

    4. make the activeLinkIdvariable to 1 --its a pointer variable
    5. in prevbutton click,
    Code:
    if(activeLinkId>1){
      clearImageLayout(pageCount * (activeLinkId-1),pageCount * (activeLinkId));
      activeLinkId --;
      setImageLayout(pageCount * (activeLinkId-1), pageCount * activeLinkId);
    }
    6. on next button click
    Code:
    if(activeLinkId<nofPages){
                clearImageLayout(pageCount * (activeLinkId-1),pageCount * (activeLinkId));
                activeLinkId ++;
                setImageLayout(pageCount * (activeLinkId-1), pageCount * (activeLinkId));
    }
    the functions
    clearImageLayout(int start,int end){
    //iterate the arraylist of images ,clear the existing images,
    //i mean remove the images from the imagelayout
    }

    setImageLayout(int start,int end){
    //iterate the arraylist of images ,add images to the imagelayout in this range
    }

    I have implemented this well...
    u also try it..
    Last edited by vinuriyer; 6 Jul 2011, 20:45.

    Comment

    Working...
    X