设为首页 - 加入收藏
您的当前位置:主页 > bodog娱乐官网 > 正文

带bodog的RangeSeekbar

来源:[db:来源] 编辑:[db:作者] 时间:2018-11-20

  项目外面面拥有个干用运用到了根据标价区间选择商品,干用完成将用到RangSeekbar,带bodog,好吧,网上壹把狂搜,邑是二顺手货,臻不到己己己想要的效实,拿个demo上缓缓改吧,代码固然拥有点多,条是干用还是要呀,产品催进度,壹把狂改之后到底拥有个样了,贴个效实图:

  

  android:id="@+id/seekbar"

  android:layout_width="wrap_content"

  android:layout_height="wrap_content" />

  

  activity外面面怎么取到值呢,我直接用了EventBus

  @BindView(R.id.seekbar)

  RangeSeekbar seekbar;

  @BindView(R.id.tv_left)

  TextView tvLeft;

  @BindView(R.id.tv_right)

  TextView tvRight;

  String arrays[]={"0", "5", "10", "15", "20", "25", "40", "60", "80", "100"};

  @Override

  protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

  ButterKnife.bind(this);

  EventBus.getDefault().register(this);

  }

  public void onEventMainThread(RangBarEvent event) {

  int mesg=event.getMsg();

  int type=event.getType();

  if (type==1) {

  //左边游标注对应值

  tvLeft.setText("左边:" + arrays[mesg]);

  } else if (type==2) {

  //左边游标注对应值

  tvRight.setText("左边:" + arrays[mesg]);

  }

  }

  RangSeekbar代码太多,此雕刻边就不多贴了,需寻求的github去下载https://github.com/hedongBlog/RangeSeekbar

Top