如何限制搜索栏 [英] how to limit seekbar

查看:223
本文介绍了如何限制搜索栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想分别设置的搜索栏最大和最小限制,以50和20。

I'd like to set max and minimum limits of SeekBar to 50 and 20 respectively.

搜索栏有着直接的选项前提供最大的价值,但是如何将其最小值到20而不是0?

SeekBar has a direct option top provide max value, but how to set its minimum value to 20 rather than 0?

推荐答案

在搜索栏您 只能设置最大值。

In SeekBar you can set only max value.

<SeekBar android:id="@+id/SeekBar01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="50"/>

和, 不能直接设置最小值到搜索栏。

And, You cannot directly set the minimum value to the seekbar.

 SeekBar mSeekbar = (SeekBar) findViewById(R.id.SeekBar01);

    mSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
    {
       public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
       {
            length_edit.setText(Integer.toString(progress + 20));
       }

      public void onStartTrackingTouch(SeekBar seekBar) {}

      public void onStopTrackingTouch(SeekBar seekBar) {}
    });

正如你所看到分钟的进步可以用分钟,我想总结 - 在你的案件20

As you see min progress you can sum with min which I would like - in your case 20.

享受!!!!

这篇关于如何限制搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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