如何让Android的comboseekbar主所选择的步进值 [英] How to get the step value selected in android-comboseekbar-master

查看:1460
本文介绍了如何让Android的comboseekbar主所选择的步进值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建使用的库 Android的comboseekbar主一个comboseekbar。而我实现了XML和code

I created a comboseekbar using the library android-comboseekbar-master. And i implemented the xml and code

<com.infteh.comboseekbar.ComboSeekBar
        android:id="@+id/seekbar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_marginRight="5dip"
        app:multiline="false"
        app:textSize="12sp"
        app:color="#124578" />

在Java的code

In the java code

ComboSeekBar mSeekBar;


mSeekBar = (ComboSeekBar) rootView.findViewById(R.id.seekbar);
        List<String> seekBarStep = Arrays.asList("1", "5", "15", "25", "50",
                "100");
        mSeekBar.setAdapter(seekBarStep);

现在我已经设置了一步值[1,5,15 ...],但我怎么能得到逐步值当用户拖动并在搜索栏选择每个..

Now i have set the step-value[1,5,15...], but how can i get the step-value when the user drags and selects each in the seekbar..

推荐答案

我看着到库中。我不认为这是对于一个选项。虽然周围有密切的工作,看看我的code,如果你发现这个适合使用它,否则,你可以编辑库。

I looked into the library . I don't think there is an option for that. Although there is a close work around,look at my code, if you find this suitable use it, otherwise you can edit the library.

mSeekBar.setOnItemClickListener(new OnItemClickListener() {

   @Override
   public void onItemClick(AdapterView<?> parent, View view,
     int position, long id) {
    // TODO Auto-generated method stub
    toast(position + "");
    switch (position) {
    case 0:

    //do something here
     break;
    case 1:
    //do something here
     break;
    case 2:
     //do something here
     break;
    case 3:
    //do something here

     break;
    case 4:
     //do something here
     break;
    case 5:
     //do something here
     break;
    }

   }
  });

这篇关于如何让Android的comboseekbar主所选择的步进值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆