Skip to content Skip to sidebar Skip to footer

Rating Bar Like Android In Codename One

I want to add Add Raring Bar in a Form of codename one like android.. But am afraid there is no GUI for to create in codename one.. Is there any other option for to create it..

Solution 1:

I think someone contributed a component like that on the discussion forum once, but I can't find the link.

It should be relatively simple to create using something like this (didn't test this code though):

ContainerstarSelect=newContainer(newBoxLayout(BoxLayout.X_AXIS));
for(intiter=0 ; iter < 5 ; iter++) {
    createStarButton(starSelect);
}

voidcreateStarButton(final Container parent) {
    finalCheckBoxcb=newCheckBox();
    cb.setToggle(true);
    cb.setIcon(unselectedStarIcon);
    cb.setPressedIcon(selectedStarIcon);
    cb.addActionListener(newActionListener() {
         publicvoidactionPerformed(ActionEvent ev) {
            if(cb.isSelected()) {
                booleanselected=true;
                for(intiter=0 ; iter < parent.getComponentCount() ; iter++) {
                    Componentcurrent= parent.getComponentAt(iter);
                    if(current == cb) {
                       selected = false;
                       continue;
                    }
                    ((CheckBox)cb).setSelected(selected);
                }
            }
         }
    });
    parent.addComponent(cb);
}

Solution 2:

I'am not iOS developer but i can provide some links please try

1.DLStarRating

2.RatingBar

3.XLRatingBar

4.Sample RatingBar Project

Post a Comment for "Rating Bar Like Android In Codename One"