English 中文(简体)
Android设法阻止 d积,在很短的时间里加以阻断。
原标题:Android seekbar how to block dragging / disable it for short time

I want to block the dragging of a seekbar if a value is true. Is this even possible? I use a seekbar as a switch. If my seekbar value is 0, and I press the button action A started. If my seekbar value is 1 and I press the button action B is started.
I want to prevent that If action A or B is running the seekbar is dragged to another position.

How can I achieve this?

最佳回答

你应该把自己定在TouchListener身上,公正返回。

seekBar.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                return true;
            }
        });
问题回答
int lastProgress=0;
  1. • 追踪“察看”时代的最后进展。 OnSeekbarChangeListener遭到射击。

    private SeekBar.OnSeekBarChangeListener mOnSeekbarChangeListener = new 
    
    SeekBar.OnSeekBarChangeListener() {
    @Override
    public void onProgressChanged(SeekBar seekbar, int progress, boolean fromUser) {
        if (fromUser) {
            if (true) {
                seekbar.setProgress(lastProgress);
            } else {
                seekbar.setProgress(progress);
            }
        }
    }
    
    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        lastProgress = seekBar.getProgress();
    }
    
    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    
    }
    };
    




相关问题
How to start to create an application GUI using C#?

HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...

Automatic height of edit box

My shoes application has three items stacked on top of each other (with a stack, of course), in order: A banner An edit box Two buttons in a flow What I want to do is have the banner stay at it s ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

UI And TcpClient Issue in vb.net

I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...

UI Convention: Shortcut key for application exit? [closed]

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...

热门标签