gpt4 book ai didi

android - 如何通过更改 EditText 中的值来更改搜索栏进度位置?

转载 作者:行者123 更新时间:2023-11-29 15:24:01 25 4
gpt4 key购买 nike

  I want to change the seekbar progress position by changing the value in EditText dynamically. please help me out from this issue .

<EditText
android:id="@+id/editText1"
android:layout_width="120dp"
android:layout_height="wrap_content" />

<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="4990000"
android:progress="10" />

这是java代码

    seekbar1 = (SeekBar) findViewById(R.id.seekBar1);
seekbar1.setProgress(30);
seekbar1.setOnSeekBarChangeListener( new OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser)
{
spinnervalue=(EditText)findViewById(R.id.editText1);

spinnervalue.setText(""+Integer.toString(progress));

// Notify that the progress level has changed.

if(txtAmount.getText().length() > 0
&& txtYears.getText().length() > 0
&& txtRate.getText().length() > 0)
{
calculate();
}

}

});

因此,通过根据输入的值更改编辑文本中的值,搜索栏必须移动到特定值。

最佳答案

尝试SeekBarsetProgress(Value)。它应该在您的 Seekbar 支持的值范围内。

关于android - 如何通过更改 EditText 中的值来更改搜索栏进度位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14829801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com