GithubHelp home page GithubHelp logo

warkiz / indicatorseekbar Goto Github PK

View Code? Open in Web Editor NEW
2.2K 43.0 414.0 45.44 MB

A custom SeekBar on Android, which can be changed the size ,color , thumb drawable , tick drawable , tick text and indicator , also , will show an indicator view with progress above SeekBar when seeking. https://github.com/warkiz/IndicatorSeekBar

License: Apache License 2.0

Java 100.00%
seekbar

indicatorseekbar's Introduction

IndicatorSeekBar

DOWNLOAD API Android Arsenal

This is a customizable SeekBar library on Android. Also, If you don't need indicator and want to show tick texts to top of seek bar, please see the other library.

中文.md

Overview

Screenshot

Demo

download apk

Scan QR code to download:

Setup

implementation 'com.github.warkiz.widget:indicatorseekbar:2.1.2'

Usage

xml

<com.warkiz.widget.IndicatorSeekBar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:isb_max="100"
    app:isb_min="-1.0"
    app:isb_progress="25"
    app:isb_seek_smoothly="true"
    app:isb_ticks_count="5"
    app:isb_show_tick_marks_type="oval"
    app:isb_tick_marks_size="13dp"
    app:isb_tick_marks_drawable="@mipmap/ic_launcher"
    app:isb_show_tick_texts="true"
    app:isb_tick_texts_size="15sp"
    app:isb_tick_texts_color="@color/color_blue"
    app:isb_thumb_color="@color/color_green"
    app:isb_thumb_size="20dp"
    app:isb_show_indicator="rounded_rectangle"
    app:isb_indicator_color="@color/color_gray"
    app:isb_indicator_text_color="@color/colorAccent"
    app:isb_indicator_text_size="18sp"
    app:isb_track_background_color="@color/color_gray"
    app:isb_track_background_size="2dp"
    app:isb_track_progress_color="@color/color_blue"
    app:isb_track_progress_size="4dp"
    app:isb_only_thumb_draggable="false"/>

Java

 IndicatorSeekBar seekBar = IndicatorSeekBar
                .with(getContext())
                .max(110)
                .min(10)
                .progress(53)
                .tickCount(7)
                .showTickMarksType(TickMarkType.OVAL)
                .tickMarksColor(getResources().getColor(R.color.color_blue, null))
                .tickMarksSize(13)//dp
                .showTickTexts(true)
                .tickTextsColor(getResources().getColor(R.color.color_pink))
                .tickTextsSize(13)//sp
                .tickTextsTypeFace(Typeface.MONOSPACE)
                .showIndicatorType(IndicatorType.ROUNDED_RECTANGLE)
                .indicatorColor(getResources().getColor(R.color.color_blue))
                .indicatorTextColor(Color.parseColor("#ffffff"))
                .indicatorTextSize(13)//sp
                .thumbColor(getResources().getColor(R.color.colorAccent, null))
                .thumbSize(14)
                .trackProgressColor(getResources().getColor(R.color.colorAccent,null))
                .trackProgressSize(4)
                .trackBackgroundColor(getResources().getColor(R.color.color_gray))
                .trackBackgroundSize(2)
		.onlyThumbDraggable(false)
                .build();

Indicator stay always

Put IndicatorSeekBar into a IndicatorStayLayout can make the indicator stayed always. By the way, make sure you had called the attr to show the indicator before.

Xml

<com.warkiz.widget.IndicatorStayLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <!--your layout-->
    <com.warkiz.widget.IndicatorSeekBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:isb_show_indicator="rectangle" <!--show indicator can not be NONE-->
        ....../>
    <!--your layout-->
</com.warkiz.widget.IndicatorStayLayout>

Java

IndicatorSeekBar seekBar = IndicatorSeekBar
                .with(getContext())
                .max(50)
                .min(10)
                .showIndicatorType(IndicatorType.RECTANGLE) //show indicator can not be NONE
                ...
                .build();

new IndicatorStayLayout(getContext()).attachTo(seekBar);

Custom indicator's View

You can custom the indicator View by below way:

If you want to replace the indicator's View on top part, you can call:

 seekBar.getIndicator().setTopContentView(yourTopView);

or want to custom the indicator's View you want , you can call:

seekBar.getIndicator().setContentView(yourView);

Custom indicator's text

Set a format string with placeholder ${PROGRESS} or ${TICK_TEXT} to IndicatorSeekBar, the indicator's text would change. For example: If you want to show the progress with suffix: % ,the code like:

seekBar.setIndicatorTextFormat("${PROGRESS} %")

Kotlin:
seekBar.setIndicatorTextFormat("\${PROGRESS} %")

or want to show the tick text with prefix: I am ,the code like:

seekBar.setIndicatorTextFormat("I am ${TICK_TEXT}")

Kotlin:
seekBar.setIndicatorTextFormat("I am \${TICK_TEXT}")

Custom section tracks color

The color of every block of seek bar can also be custom.

seekBar.customSectionTrackColor(new ColorCollector() {
    @Override
    public boolean collectSectionTrackColor(int[] colorIntArr) {
        //the length of colorIntArray equals section count
        colorIntArr[0] = getResources().getColor(R.color.color_blue, null);
        colorIntArr[1] = getResources().getColor(R.color.color_gray, null);
        colorIntArr[2] = Color.parseColor("#FF4081");
        ...
        return true; //True if apply color , otherwise no change
    }
});

Selector drawable&color were supported

You can set the StateListDrawable or ColorStateList for the thumb, tickMarks; also, ColorStateList for tickTexts is supported, too. Usage's format according to:

Thumb selector drawable:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!--this drawable is for thumb when pressing-->
    <item android:drawable="@mipmap/ic_launcher_round" android:state_pressed="true" />
    <!--for thumb in normal-->
    <item android:drawable="@mipmap/ic_launcher" />
</selector>

Thumb selector color:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!--this color is for thumb which is at pressing status-->
    <item android:color="@color/colorAccent" android:state_pressed="true" />
    <!--for thumb which is at normal status-->
    <item android:color="@color/color_blue" />
</selector>

TickMarks selector drawable:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!--this drawable is for tickMarks those are at start side of thumb-->
    <item android:drawable="@mipmap/ic_launcher_round" android:state_selected="true" />
    <!--for tickMarks in normal-->
    <item android:drawable="@mipmap/ic_launcher" />
</selector>

TickMarks selector color:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!--this color is for marks those are at start side of thumb-->
    <item android:color="@color/colorAccent" android:state_selected="true" />
    <!--for marks those are at right side of thumb-->
    <item android:color="@color/color_gray" />
</selector>

TickTexts selector color:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!--this color is for texts those are at start side of thumb-->
    <item android:color="@color/colorAccent" android:state_selected="true" />
    <!--for tick text which is stopped under thumb -->
    <item android:color="@color/color_blue" android:state_hovered="true" />
    <!--for texts those are at right side of thumb-->
    <item android:color="@color/color_gray" />
</selector>

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) {
            }
        });

Attributes

attr.xml

Donation by Paypal , thanks

So happy to receive your donation or encouraging words , and I will post this on my thanks-lists , thanks.

自从文档里公布了二维码,我收到国内的朋友的一些打赏,虽然金额不大,但是一些支持和鼓励的话语还是让我感到开心,非常感谢。

感谢所有之前支持我的朋友。如果下次你要给我打赏,可以顺带写上你的github地址,我会在这里用 链接 贴出来,算是相互鼓励。

Thanks-lists

非常感谢列表中的朋友,你们的肯定和支持是我前进的最大动力!

Thanks for all the friends on the lists!

Name/昵称 Date/日期 Payment Tools/方式 Words/留言 Friendly link/友情连接
[E*e] 2019-06-27 微信
[*●] 2019-06-14 微信
[*宣] 2019-06-05 支付宝
[*圆] 2019-05-29 支付宝 加油 GitHub/SaltedFish999
[*兴明] 2019-02-12 支付宝 GitHub/jdpxiaoming
[*j!n] 2019-01-08 微信 666 GitHub/jincom
[*乐] 2018-12-19 支付宝
[*勇] 2018-12-05 微信
[*天佑] 2018-11-05 支付宝
[*勇] 2018-10-16 支付宝
[*利成] 2018-05-22 支付宝

Contact me

Feel free to contact me if you have any trouble on this project:

  1. Create an issue.
  2. Send mail to me, "warkiz".concat("4j").concat("@").concat("gmail.com")

License

Copyright (C) 2017 zhuangguangquan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

indicatorseekbar's People

Contributors

anhmiuhv avatar edgar-v avatar hexey avatar lhoyong avatar quelake avatar themaxcoder avatar warkiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

indicatorseekbar's Issues

Indicator PopupWindow not setting in coodrinatorlayout

The indicator pop up doesnt move in y(vertically when scrolled) with the seekbar while using inside coordinator layout. first time is fine but when you scroll down or up it doesnt move with seek bar(its stays fixed).
Im using nestedscrollview and appbarlayout inside coordinator layout

气泡指示器在设置mShowIndicator与mIndicatorStay为true之后不能hide

项目中需要气泡指示器常在,但是整个IndicatorSeekBar不会从界面detach的情况下,只设置IndicatorSeekBar的 visiable为gone ,只要界面有变化,气泡指示器就会重新出来;
我看了下代码 , 程序一直在调用
@OverRide
public void onGlobalLayout() {
checkIndicatorLoc();
}
而 private void checkIndicatorLoc() {
if (mIndicator == null || !p.mShowIndicator) {
return;
}
if (p.mIndicatorStay) {
if (mIndicator.isShowing()) {
mIndicator.update();
} else {
mIndicator.show();
}
} else {
mIndicator.forceHide();
}
}
这样不管我之前是否 mIndicator.forceHide();在界面有更新的时候,气泡指示器都会出来; 请问这样的情况该怎么办;有没有对于mShowIndicator或者mIndicatorStay动态设置的方法

Top Text

Hello, Can I show Text Array to top of seek bar?
I don't need indicator now,
I only want to display top text array instead of current bottom texts array.
How can I do it?

IndicatorSeekBar popUp window in vertical mode

i need to use IndicatorSeekBar in vertical mode so i set android:rotation="-90" but indicator popup window does not move with SeekBar in vertical and it move in horizontal mode
this is what i use in my layout XML :

    <com.warkiz.widget.IndicatorSeekBar
        android:id="@+id/SeekBarIndicator"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        app:isb_indicator_custom_layout="@layout/custom_indicator_rec"
        app:isb_indicator_type="custom"
        app:isb_progress="20"
        app:isb_indicator_stay="true"
        app:isb_show_indicator="true"
        app:isb_thumb_progress_stay="true"
        android:rotation="-90"/>

screenshot_2018-01-25-14-01-42 1

wrong initial state

I'm using this component:
<com.warkiz.widget.IndicatorSeekBar android:id="@+id/soc_seek" android:layout_width="0dp" android:layout_height="wrap_content" app:isb_indicator_type="circular_bubble" app:isb_max="100" app:isb_min="0" app:isb_progress="60" app:isb_seek_bar_type="discrete_ticks_texts" app:isb_tick_num="6" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/soc_chip" app:layout_constraintTop_toBottomOf="@+id/brake_chip"/>

On some devices, its rendered ok, but on sony tablet (Android 5.0.2) its rendered this way:

image

Is this a bug or I did something wrong?

关于很横竖屏切换问题

用来做视频播放的进度条,但是发现在配置文件设android:configChanges="orientation|screenSize",当切换到横屏时,Indicator无法滑到跟随最右边。

wow!

This toolkit is diaodiaodiao!

Using Continues Text ends

Hello,
I am using seekbar type "Continuous text ends". In which I am facing issue about right side end text.
In layout I am seeing right side text but when I am running my app in device that will not show.
Only left side text is visible and end side text is not visible.
Please help me.
device-2018-02-08-192643 1

I am looking forward for the reply.
Thank you.

Feature - Customized Tick

Can the tick be customized for selected and non selected.

Suppose, the progress is at 50 and at progress 0 and 25 tick should have different color while at progress 75 and 100 tick color will be different.

If this is possible please let me know.
I don't think I have any solution
Right now there is isb_tick_drawable and isb_tick_color
I was looking for something like selector

How much customization can be done by self?

Thanks in advance.

Feature: possibility to set ticks / values manually

... so the distance - mSeekBlockLength - may vary.
The API could be like this:
... .setMax(200).setMin(0).addTick(0).addTick(10).addTick(50).addTick(190) ...
This could be used in union with setTickNum()

Multi-line Text

Is it possible to make the text multiline?
I put the this text "1st & 2nd\nDish" and it shows in a single line.

I'm using the "isb_seek_bar_type="discrete_ticks_texts"" type of seekbar

Error inflating class com.lenovo.linkapp.plugin.plugdemo.seekbar.ArrowView

04-04 11:25:31.494 31294-31294/com.lenovo.linkapp.plugin.plugdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.lenovo.linkapp.plugin.plugdemo, PID: 31294
android.view.InflateException: Binary XML file line #29: Error inflating class com.lenovo.linkapp.plugin.plugdemo.seekbar.ArrowView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:812)
at android.view.LayoutInflater.inflate(LayoutInflater.java:510)
at android.view.LayoutInflater.inflate(LayoutInflater.java:420)
at android.view.LayoutInflater.inflate(LayoutInflater.java:371)
at android.view.View.inflate(View.java:18577)
at com.warkiz.widget.Indicator.initIndicator(Indicator.java:74)
at com.warkiz.widget.Indicator.(Indicator.java:42)
at com.warkiz.widget.IndicatorSeekBar.onMeasure(IndicatorSeekBar.java:373)
at android.view.View.measure(View.java:17582)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17582)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17582)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at android.view.View.measure(View.java:17582)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
at android.view.View.measure(View.java:17582)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2673)
at android.view.View.measure(View.java:17582)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2053)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1192)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1409)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1080)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5877)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5475)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:948)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.lenovo.linkapp.plugin.plugdemo.seekbar.ArrowView" on path: DexPathList[[zip file "/data/app/com.lenovo.linkapp.plugin.plugdemo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.lenovo.linkapp.plugin.plugdemo-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.view.LayoutInflater.createView(LayoutInflater.java:577)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:812) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:510) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:420) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:371) 
at android.view.View.inflate(View.java:18577) 
at com.warkiz.widget.Indicator.initIndicator(Indicator.java:74) 
at com.warkiz.widget.Indicator.(Indicator.java:42) 
at com.warkiz.widget.IndicatorSeekBar.onMeasure(IndicatorSeekBar.java:373) 
at android.view.View.measure(View.java:17582) 
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727) 
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463) 
at android.view.View.measure(View.java:17582) 
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727) 
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463) 
at android.view.View.measure(View.java:17582) 
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467) 
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) 
at android.view.View.measure(View.java:17582) 
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467) 
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436) 
at android.widget.LinearLayout.measureVertical(LinearLayout.java:722) 
at android.widget.LinearLayout.onMeasure(LinearLayout.java:613) 
at android.view.View.measure(View.java:17582) 
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5467) 
at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) 
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2673) 
at android.view.View.measure(View.java:17582) 
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2053) 
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1192) 
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1409) 
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1080) 
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5877) 
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) 
at android.view.Choreographer.doCallbacks(Choreographer.java:580) 
at android.view.Choreographer.doFrame(Choreographer.java:550) 
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5475) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:948) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:743) 
Suppressed: java.lang.ClassNotFoundException: com.lenovo.linkapp.plugin.plugdemo.seekbar.ArrowView
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(C

Rectangular Tick

Hello!
Could you please also give an example with a rectangular tick for the seekbar?
I'm trying to set a rectangular tick for the IndicatorSeekBar but it doesn't show up in the xml. What I've tried.

<com.warkiz.widget.IndicatorSeekBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:isb_indicator_color="@color/colorPrimary"
            app:isb_track_background_bar_color="@color/colorPrimary"
            app:isb_track_progress_bar_color="@color/colorPrimary"
            app:isb_indicator_type="rectangle"
            app:isb_tick_type="rec"
            app:isb_tick_color="@color/colorPrimary"
            app:isb_tick_both_end_hide="false"
            app:isb_max="3"
            app:isb_progress="0"
            app:isb_tick_num="4"
            app:isb_show_indicator="true"
            app:isb_indicator_stay="true"
            app:isb_thumb_width="24dp"
            app:isb_thumb_drawable="@drawable/seek_bar_thumb"
            app:isb_tick_size="24dp"
            app:isb_tick_drawable="@drawable/seek_bar_tick"
            android:paddingEnd="@dimen/activity_horizontal_margin"
            android:paddingStart="@dimen/activity_horizontal_margin"
            />

Thank you!

Wrong tick labels after setProgress

Hi. Nice widget.
I've found a problem after setProgress is called. The tick labels disappear, and the only way to solve it is defining a string array. By example, this fails:

IndicatorSeekBar seekbar = (IndicatorSeekBar) view.findViewById(R.id.seekBar); seekbar.setProgress(5);

This also fails:

seekbar.getBuilder() .setMin(0) .setMax(10) .setTickNum(11) .setProgress(5) .apply();

And this is my empirical solution:

seekbar.getBuilder() .setMin(0) .setMax(10) .setTickNum(11) .setTextArray(R.array.slider_ticks_1_10) .setProgress(5) .apply();

The example array is just a 0-10 string values.
The xml is defined as:

<com.warkiz.widget.IndicatorSeekBar android:id="@+id/seekBar" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:paddingBottom="20dp" android:paddingTop="20dp" app:isb_clear_default_padding="false" app:isb_max="10" app:isb_min="0" app:isb_progress="1" app:isb_seek_bar_type="discrete_ticks_texts" app:isb_show_indicator="false" app:isb_text_color="@color/textColor" app:isb_text_size="@dimen/textsize_medium" app:isb_thumb_color="@color/colorAccentDark" app:isb_thumb_width="@dimen/ikdc_slider_thumb_width" app:isb_tick_color="@color/colorAccentDark" app:isb_tick_num="10" app:isb_tick_size="15dp" app:isb_tick_type="oval" app:isb_track_background_bar_size="10dp" app:isb_track_progress_bar_color="@color/colorAccent" app:isb_track_progress_bar_size="20dp" app:isb_track_rounded_corners="true" />

The seekbar is shown right if setProgress is not called.
I'm doing something wrong?

Range Seekbar

Is it possible to make it a Range Seekbar with 2 thumbs ?

当设置气泡一直在 不消失的时候

当设置气泡一直在不消失的时候,屏幕上下滑动 气泡也会动 ,或者说假如一开始气泡在某个位置 当页面内容发生变化后,气泡所在位置没有变化,当再次滑动时候 气泡才回来

Not showing text when tickNum is 2

In my code I have random numbers generated and added to seekBar, sometimes 2 numbers generated and the size of seekBar become two. The text under tick is not showing.
My code is:
final CharSequence[] months = {"60", "90"}; final int monthsLen = months.length; depositPeriod_SeekBar.getBuilder() .setTextArray(months) .setTickNum(monthsLen) .apply();

As you can see in the image below seekBar is not showing numbers? but it can drag and pass position correctly.

SeekBar Image

无法动态设置

当我在布局里面使用的时候,在代码里我需要请求网络获取到最小值和最大值,然后再设置progress,会出现问题,比如我请求网络后获取最小值1000,最大值5000,我要设置progress为最小值,也就是说指示器应该在起点位置,并且气泡是一直都存在的,这个时候就会出现问题,气泡和指示器有偏移,而且气泡上显示的数值并不是1000

Indicator stays on the top of all Views?

@warkiz first, many thanks for this library! It's a great!

Then, I have a left menu at my app, and when I open/swipe the menu/tab to the right, the bubbles appear over the tab while the rest of the seekbar is normally displayed (not seen, under the tab). Seems that the indicator is above/on top of all Views. Is that correct?

I have also a top toolbar displaying the name of the activity, and scrolling all the way down (I have a ScrollView), the indicator just disappears behind the top toolbar, which is perfect. Would be great achieved the same thing when I open my left menu. I hope you can get what I mean.

Just in case, I'm using a Google Pixel with Android 8.1.0 and the last version of you development -> 'com.github.warkiz.widget:indicatorseekbar:1.2.4'

Thanks in advance! :)

No disabled state

Tried to disabled to seekbar using
setEnabled(false)
or
setActivated(false)

But it does not affect the view.

The only thing that works, is forbidUserToSeek
but that leaves the view in a enable state (colors etc.)

Any way to make it greyed out so it will look disabled?

demo.apk: parse error

I try to install your demo.apk on a SDK v 10 device (SonyEricsson LT18i). Result: "Parse error - There is a problem parsing the package"

Bug: Using "seekbar.setMax()" programmatically should change the Thumb position after maxValue changes successfully but it does not

I am changing the maxValue of the seekbar using seekbar.setMax() in my java code. After I change the maxValue, I would expect the thumb position to be recalculated according to the new max value but it does not.

For example, if my minValue is 0, maxValue is 100 and progress is 75, the thumb position should be at 3/4th of the length of the seekbar. Now when I change the maxValue to 150, I would expect the thumb to move to half the length of the seekbar but it wont.

Currently I am using a workaround by calling seekbar.setProgress(seekbar.getProgress()) after calling the seekbar.setMax() every time.

Ticker shows a values less

<com.warkiz.widget.IndicatorSeekBar app:isb_max="5" app:isb_min="0" app:isb_progress="0" app:isb_show_indicator="true" app:isb_indicator_type="circular_bubble" app:isb_indicator_text_size="14dp" app:isb_seek_bar_type="discrete_ticks"/>
if I use this seekbar it shows a value less. For example here it should shows value from 0 to 5 so in total are 6. It shows 0,2,3,4,5 = 5, not 6. Without discrete ticks no problems here. Thank you for the custom seekbar, you saved my day :)

setting font

Sorry for my noob questions.

  1. in xml file we have app:isb_text_typeface="" . How to set font here from my res/font or asset/myfonts
  2. will app:isb_text_typeface="" change font at the at isb_text_left_end and isb_text_right_end?

IndicatorSeekBar is awesome,Thank you)

Custom typeface

Is it possible to add a custom typeface?
I saw that you add the text to a TextPaint and this class has the method setTypeface, maybe if you add an attribute that could be the typeface it will be possible to use a custom typeface.

Change seekbar progress from code with animation

Enhancement:

I guess it would look much better if you can change the value of the seekbar with animation (just a smooth movement of the thumb rather than abrupt movement) when changed programatically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.