Skip to content

CustomSeekBar

DV Infosys edited this page Jun 21, 2019 · 1 revision

CustomSeekBar

This is a CustomSeekBar library on android

Usage

<com.dvinfosys.widgets.SeekBar.CustomSeekBar
                   android:id="@+id/sb_speed"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:layout_margin="8dp"
                   android:visibility="visible"
                   app:sb_indicator_color="@color/color_gray"
                   app:sb_indicator_text_color="@color/defualt_black"
                   app:sb_indicator_text_size="18sp"
                   app:sb_max="3"
                   app:sb_min="-3"
                   app:sb_only_thumb_draggable="false"
                   app:sb_progress="0"
                   app:sb_seek_smoothly="true"
                   app:sb_show_indicator="rounded_rectangle"
                   app:sb_show_tick_marks_type="none"
                   app:sb_show_tick_texts="true"
                   app:sb_thumb_color="@color/defualt_black"
                   app:sb_thumb_size="15dp"
                   app:sb_tick_marks_color="@color/color_select_thumb"
                   app:sb_tick_marks_size="13dp"
                   app:sb_tick_texts_color="@color/defualt_black"
                   app:sb_tick_texts_size="15sp"
                   app:sb_ticks_count="6"
                   app:sb_track_background_color="@color/color_gray"
                   app:sb_track_background_size="2dp"
                   app:sb_track_progress_color="@color/color_select_thumb"
                   app:sb_track_progress_size="4dp" />

Listener

seekBar.setOnSeekChangeListener(new OnSeekChangeListener() {
            @Override
            public void onSeeking(SeekParams seekParams) {
                Log.i(TAG, seekParams.seekBar);
                Log.i(TAG, seekParams.progress);
                Log.i(TAG, seekParams.progressFloat);
                Log.i(TAG, seekParams.fromUser);
                //when tick count > 0
                Log.i(TAG, seekParams.thumbPosition);
                Log.i(TAG, seekParams.tickText);
            }

            @Override
            public void onStartTrackingTouch(IndicatorSeekBar seekBar) {
            }

            @Override
            public void onStopTrackingTouch(IndicatorSeekBar seekBar) {
            }
        });
Clone this wiki locally