如何限制搜索栏

2023-09-05 01:51:31 作者:姐,装不来淑女范er

我想分别设置的搜索栏最大和最小限制,以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.

享受!!!!

相关推荐