动画的时间延迟

时间:2018-01-18 01:12:51

标签: java android animation time

我正在尝试使用以下代码:

m_WebView_Search.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if(m_WebView_Search.hasFocus()){
                Animation mWSE = AnimationUtils.loadAnimation(CoreActivity.this, R.anim.mWSE);
                m_WebView_Search.startAnimation(mWSE);
            }
        }
    });

但是只能在等待800ms后才能跑。因此,在执行此操作之前,只需运行800ms即可。这可能吗?如果是这样,我如何将其植入以下代码中。如果我能把它变成一个更好的变量,因为我会有更多的800ms延迟分期付款。 对不起,我真的不知道该问题的帖子。

初始角半径各为100 This is the image of the cutoff characters swell as the stretched corners[![][1]] 2

1 个答案:

答案 0 :(得分:1)

你可以这样试试。

1.使用View' public boolean postDelayed(Runnable action, long delayMillis)

int POST_DELAY_TIME = 2000;
m_WebView_Search.postDelayed(new Runnable() {
    @Override
    public void run() {
        m_WebView_Search.startAnimation(mWSE);
    }
}, POST_DELAY_TIME);

2.使用Handler' public final boolean postDelayed(Runnable r, long delayMillis)

new Handler().postDelayed(new Runnable() {

    @Override
    public void run() {
        m_WebView_Search.startAnimation(mWSE);
    }
}, POST_DELAY_TIME);