0

RatingBar gives the functionality ::

It accepts value like 1-1.5-2-2.5-3-3.5-4-4.5-5

representation::

enter image description here

Code::

<RatingBar
                android:id="@+id/RATINGinitialvalueratingID"
                style="?android:attr/ratingBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/RATINGseekBarID"
                android:clickable="false"
                android:focusable="false"
                android:numStars="5"
                android:rating="0" />

seekbar gives the functionality ::

It accepts value like 1-2-3-4-5

representation ::

enter image description here

<SeekBar
                android:id="@+id/RATINGseekBarID"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/textView1"
                android:layout_marginTop="26dp"
                android:max="100" >
            </SeekBar>

Java code for seekbar

PRICEbar = (SeekBar)findViewById(R.id.PRICEseekBarID); // make seekbar object
        PRICEbar.setOnSeekBarChangeListener(this); 
        PRICEbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                // TODO Auto-generated method stub
                PRICEtextProgress = (TextView)findViewById(R.id.PRICEtextViewProgressID);
                PRICEtextProgress.setText("Price:: Rs "+progress);
                seekBar.setMax(100);

            }
        });

Is it possible ?

how to custom design rating bar that looks visually like seekbar. ?

Hope i am clear

Devrath
  • 42,072
  • 54
  • 195
  • 297

1 Answers1

1

This might help you. It will give you the idea about how it works. You'll have to put a png file containing the ratingbar sort of design.

Community
  • 1
  • 1
Tushar Gogna
  • 4,963
  • 6
  • 31
  • 42