woxingxiao / bubbleseekbar Goto Github PK
View Code? Open in Web Editor NEWA beautiful Android custom seekbar, which has a bubble view with progress appearing upon when seeking. 自定义SeekBar,进度变化更以可视化气泡样式呈现
A beautiful Android custom seekbar, which has a bubble view with progress appearing upon when seeking. 自定义SeekBar,进度变化更以可视化气泡样式呈现
请问可以让让小气泡始终悬浮不消失吗?
在我的项目中,min=20 ,max=30,
传入一个setProgress=0 ,thumb会移除seekbar范围。bubble显示的值与progress上的值不一样。
更改轨迹的大小为1dp,我把结点的原点换成了bitmap, 然后bitmap,在轨迹较小的时候,如1dp,2dp
bitmap无法绘制完全,上下会有缺失,请问要想把biamp绘制完成,应该调整哪些参数?
如下:
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="vertical">
<com.xinli.yixinli.app.view.seekbar.BubbleSeekBar
android:id="@+id/bubble_seek_bar_score"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
app:bsb_auto_adjust_section_mark="true"
app:bsb_second_track_color="@color/c_26C3B8"
app:bsb_section_count="5"
app:bsb_show_progress_in_float="true"
app:bsb_show_section_mark="true"
app:bsb_show_text="true"
app:bsb_show_thumb_text="true"
app:bsb_text_position="bottom"
app:bsb_thumb_text_color="@color/c_26C3B8"
app:bsb_thumb_text_size="18sp"
app:bsb_track_color="@color/c_DBDBDB"/>
</LinearLayout>
mLlContent.postDelayed(new Runnable() {
@Override
public void run() {
mLlContent.setVisibility(View.VISIBLE);
}
}, 2000);
用小米not lte 2000分辨率的屏幕测试,发现滑动不太流畅,可能问题出现在onTouchEvent滑动的时候会离开滑动点,我的这个控件是放在scrollView中的,求大神指点原因,怎么修改
搞定了,在对应方法中添加, getParent().requestDisallowInterceptTouchEvent(true/false);就好了
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.xw.repo.BubbleSeekBar.correctOffsetWhenContainerOnScrolling()' on a null object reference
at com.zinier.app.ui.fragments.questions.SlidingRatingFragment$2.onScrollChanged(SlidingRatingFragment.java:119)
at android.view.ViewTreeObserver.dispatchOnScrollChanged(ViewTreeObserver.java:1016)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2514)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2446)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2079)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1119)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6060)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
Thank you for providing the library.
There is crash if we left pointer in between and move to next screen.
Is there any chance to make seek bar animation fast, if it's left in between ?
JNI DETECTED ERROR IN APPLICATION: can't call void android.view.View.setTranslationZ(float) on null object
你好,我想让刻度在拖动的时候变化率为0.5 而不是现在的0.1应该怎么设置呢。
I tried to click any place on the track but it doesn't seek to the clicked position
i think it would be nice if you added seek on touching any position
Dear Sir
我把BubbleSeekBar 跟view pager 放在同一個fragment裡,
但是會發生 touch event 衝突(BubbleSeekBar拖曳會變得很慢),
但移除viewpager,一切就可以正常工作,
請問要如何解決?
謝謝
bottom bubbleseekbar BubbleView show in wrong postion
java.lang.NullPointerException: Attempt to write to field 'int android.view.WindowManager$LayoutParams.x' on a null object reference
at .BubbleSeekBar.BubbleSeekBar$5.onAnimationUpdate(BubbleSeekBar.java:780)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1463)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:642)
at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:589)
at android.animation.ValueAnimator.start(ValueAnimator.java:1106)
at android.animation.ValueAnimator.start(ValueAnimator.java:1117)
at android.animation.AnimatorSet.start(AnimatorSet.java:586)
at BubbleSeekBar.BubbleSeekBar.autoAdjustSection(BubbleSeekBar.java:833)
at .BubbleSeekBar.BubbleSeekBar.access$100(BubbleSeekBar.java:48)
at.BubbleSeekBar.BubbleSeekBar$2.run(BubbleSeekBar.java:624)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
多谢贡献优雅易用的控件, 如果能提供自定义首尾文字就更好了.
请问进度上边的popup可不可以一直显示 不要dismiss?
bubbleSeekBar1.getConfigBuilder()
.min(1000)
.max(10000)
.sectionCount(9)
.progress(5000)
.showSectionText()
.showSectionText()
.showSectionMark()
.showSectionMark()
.seekBySection()
.build();
当前进度设置了5000,实际只显示了3000?
是不是我姿势不对
如标题所属
你好, 我现在有个需求是要某个位置强制停留。 比如100元~30000元。 用户必须以100为单位递增。
但是我配置了。发现进度条有问题。 如果最小值是500,最大值是3000 效果都是好的。
最小值配置100,最大值配置30000就有问题了。
this.postDelayed(new Runnable() {
public void run() {
BubbleSeekBar.this.showBubble();
BubbleSeekBar.this.triggerBubbleShowing = true;
}
}, location[0] == 0 && location[1] == 0?300L:0L);
看了下源码是用handle传Runnable来更新UI的,如果用户在Runnable的方法被调用前离开了activity,这个方法还是会更新UI的,造成的后果就是,页面上多了一个泡泡图标,只能重启应用。
所以,是不是应该提供一个取消的方法,也更新ui前判断下是否被取消显示。
this.mBubbleView.animate().alpha(1.0F).setDuration(this.mAnimDuration).setListener(new AnimatorListenerAdapter() {
public void onAnimationStart(Animator animation) {
BubbleSeekBar.this.mWindowManager.addView(BubbleSeekBar.this.mBubbleView, BubbleSeekBar.this.mLayoutParams);
}
}).start();
我看到了,有如下这个方法用来隐藏那个泡泡图标,但我试了调用
seedbar.onStartTemporaryDetach();
和
viewGroup.removeView(seedbar);
都没有用
protected void onDetachedFromWindow() {
this.hideBubble();
super.onDetachedFromWindow();
}
bubbleSeekBar1.getConfigBuilder()
.max(10000)
.min(1000)
.progress(5000)
.sectionCount(9)
// .showSectionMark()//隐藏刻度
.autoAdjustSectionMark()
.showSectionText()
.sectionTextPosition(BOTTOM_SIDES)
.build();
bubbleSeekBar1.setOnProgressChangedListener(new BubbleSeekBar.OnProgressChangedListener() {
@OverRide
public void onProgressChanged(int progress, float progressFloat) {
Log.i("====","onProgressChanged="+progress+"");
}
@Override
public void getProgressOnActionUp(int progress, float progressFloat) {
Log.i("====","getProgressOnActionUp="+progress+"");
}
@Override
public void getProgressOnFinally(int progress, float progressFloat) {
Log.i("====","getProgressOnFinally="+progress+"");
}
});
因业务需要,设置seekBar,min为0,max为小数...
但是该方法只能设置int数据类型
在源码669行有对3参数传入的progress和转换成float的max进行比较
请问能否干脆添加一个可以设置float类型参数的方法
谢谢!
how to add thumb drawable bubbleSeekbar?
when i touch the launch icon,the crash.please fix it.thx
then,i try with my other phone.
HUAWEI C8817E
SAMSUNG S7
is also crash.
你好,这个控件支持竖的吗?
Thank you for this great library.
Is it possible to reverse direction of this bar, meaning that to start from right and end it on the left side?
Suggestion to add ability to pass an Array that can be used as section labels instead of the numeric value. The length of array must be less than or equal to number of sections. This text is displayed below section text and evenly spread across the track.
Here is an example... (sorry formatting is off and I cant figure it out)
How do you feel:
|----------|----------|----------|----------|
1 2 3 4 5
Terrible OK Awesome
类似下面这样
` public interface OnProgressChangedListener {
void onProgressChanged(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat);
void getProgressOnActionUp(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat);
void getProgressOnFinally(BubbleSeekBar bubbleSeekBar, int progress, float progressFloat);
}`
这样在一个页面有多个BubbleSeekBar时可以共用一个回调,Android很多控件的回调都是带了View参数的,如View的点击回调、CheckBox的setOnCheckedChangeListener。
public interface OnClickListener {
/**
* Called when a view has been clicked.
*
* @param v The view that was clicked.
*/
void onClick(View v);
}
java.lang.NullPointerException: Attempt to write to field 'int android.view.WindowManager$LayoutParams.x' on a null object reference
at com.xw.repo.BubbleSeekBar$6.onAnimationUpdate(BubbleSeekBar.java:826)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1374)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:602)
at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:550)
at android.animation.ValueAnimator.start(ValueAnimator.java:1039)
at android.animation.ValueAnimator.start(ValueAnimator.java:1050)
at android.animation.AnimatorSet.start(AnimatorSet.java:585)
at com.xw.repo.BubbleSeekBar.autoAdjustSection(BubbleSeekBar.java:884)
at com.xw.repo.BubbleSeekBar.access$100(BubbleSeekBar.java:49)
at com.xw.repo.BubbleSeekBar$2.run(BubbleSeekBar.java:648)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
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:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
当 SeekBar 上方有控件显示或隐藏时, 在 onMeasure 中获取点的位置是不准的. 只有在 onLayout 时, 才能保证其父 View 的所有子 View 都测量完毕, 位置才是准的.
java.lang.NullPointerException
at com.xw.repo.BubbleSeekBar.onMeasure(BubbleSeekBar.java)
at android.view.View.measure(View.java:16555)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5147)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1430)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:716)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:609)
at android.view.View.measure(View.java:16555)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
at android.view.View.measure(View.java:16555)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1999)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1171)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1356)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1058)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5974)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:780)
at android.view.Choreographer.doCallbacks(Choreographer.java:593)
at android.view.Choreographer.doFrame(Choreographer.java:562)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:766)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5315)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
at dalvik.system.NativeStart.main(Native Method)
Reading a file should be much better than kicking off an entire process.
You can check out this implementation.
没有提供setMax()这个方法?只能在Xml里面通过app:bsb_max="50"属性设置?
进度条上的气泡样式想换个,支持吗?
This is really nice ... but I would like to suggests two enhancements:
Oftentimes we want to use a seek bar which has only a discrete number of steps (e.g. 0,1, ...,10). Provide support for this via an attribute (e.g. number_steps). Of course, if set, the seek button should behave magnetically as well, i.e. it should not slide smoothly but snap to the nearest step position.
It would be very nice for compact UIs if you can have an option whereby you show the value of the seekbar as text on the seek button itself (which can be configured to be either a circle or rounded rectangle). Then, when the user drags the button, you can pop up your bubble view to indicate the seek value temporarily (because the finger will be blocking the button)
频繁的点击滑动点,立马崩溃。。
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:253)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at com.huarui.herolife.widget.BubbleSeekBar$2.onAnimationStart(BubbleSeekBar.java:495)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationStart(ViewPropertyAnimator.java:1111)
at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:925)
at android.animation.ValueAnimator.start(ValueAnimator.java:962)
at android.animation.ValueAnimator.start(ValueAnimator.java:969)
at android.view.ViewPropertyAnimator.startAnimation(ViewPropertyAnimator.java:925)
at android.view.ViewPropertyAnimator.start(ViewPropertyAnimator.java:425)
at com.huarui.herolife.widget.BubbleSeekBar.showBubble(BubbleSeekBar.java:497)
at com.huarui.herolife.widget.BubbleSeekBar.onTouchEvent(BubbleSeekBar.java:396)
如题
I am using a view pager inside fragment. I used Bubbleseekbar inside fragment item of viewpager.
on first fragment item of viewpager bubbleseekbar is fine and displaying as expected (thumbText is animating well).
But on next fragment items thumbText is not animating and stay at rightAligned to seekbar.
check it to view the error. take a look of snaps or this
我是不是要在action up 自定写一个回调。。。还有我想在进度条左右加个加减的按钮,每按一次当前滑动一个。。。
我的QQ是496851028 不知道方不方便加下 有点问题想请教下。。。
When min is set to 500, and max is set to 1000, display error.
我在Activity的底部有一个该控件,当设置总是显示时,那个提示飞到Toolbar上去了。
I have a material dialog in a fragment and the second time it is created if i try to scroll the seekbar immediately after its creation it crashes with this error:
03-08 18:10:17.986 4027-4027/com.tea2code.e_gym E/InputEventReceiver: Exception dispatching input event. 03-08 18:10:17.986 4027-4027/com.tea2code.e_gym E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback 03-08 18:10:17.990 4027-4027/com.tea2code.e_gym E/MessageQueue-JNI: android.view.WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@b8ed3ad has already been added at android.view.ViewRootImpl.setView(ViewRootImpl.java:691) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94) at com.xw.repo.BubbleSeekBar$4.onAnimationStart(BubbleSeekBar.java:584) at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationStart(ViewPropertyAnimator.java:1089) at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:951) at android.animation.ValueAnimator.startAnimation(ValueAnimator.java:1186) at android.animation.ValueAnimator.start(ValueAnimator.java:1000) at android.animation.ValueAnimator.start(ValueAnimator.java:1014) at android.view.ViewPropertyAnimator.startAnimation(ViewPropertyAnimator.java:903) at android.view.ViewPropertyAnimator.start(ViewPropertyAnimator.java:415) at com.xw.repo.BubbleSeekBar.showBubble(BubbleSeekBar.java:586) at com.xw.repo.BubbleSeekBar.onTouchEvent(BubbleSeekBar.java:430) at android.view.View.dispatchTouchEvent(View.java:10024) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2264) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:413) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1808) at android.app.Dialog.dispatchTouchEvent(Dialog.java:799) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:375) at android.view.View.dispatchPointerEvent(View.java:10244) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4444) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4312) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3859) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3912) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3878) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4005) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3886) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4062) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3859) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3912) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3878) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3886) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3859) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6252) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6226) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6187) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6355) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(Me
My code is like this:
`dialog = new MaterialDialog.Builder(getActivity())
.title(getString(R.string.search_dialog_distance))
.customView(R.layout.distance_dialog, true)
.positiveText(getString(android.R.string.search_go))
.negativeText(android.R.string.cancel)
.cancelListener(new DialogInterface.OnCancelListener() {
@OverRide
public void onCancel(DialogInterface dialog) {
try {
progressBar.setVisibility(View.GONE);
location.setVisibility(View.VISIBLE);
location.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.places_ic_search));
location.setAlpha(0.5f);
Toast.makeText(getActivity(), getString(R.string.search_dialog_cancel), Toast.LENGTH_LONG).show();
} catch (Exception e) {
Log.e("Changed Tab", "KM List:" + e.getMessage());
}
}
})
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Toast.makeText(getActivity(), Integer.toString(distance), Toast.LENGTH_LONG).show();
task = new AsyncCaller();
task.execute();
}
}).build();
mBubbleSeekBar = (BubbleSeekBar) dialog.findViewById(R.id.bubble_seek_bar);
distance = mBubbleSeekBar.getProgress();
mBubbleSeekBar.setOnProgressChangedListener(new BubbleSeekBar.OnProgressChangedListenerAdapter() {
@Override
public void onProgressChanged(int progress) {
distance = progress;
}
});
dialog.show();`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.