使 ImageView 在设定的时间内可见

编程入门 行业动态 更新时间:2024-10-22 15:25:34
本文介绍了使 ImageView 在设定的时间内可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 xml 布局文件中设置了一个 onClick 方法,该方法触发手机振动 100 毫秒,此时我将 ImageView Visibility 设置为可见,以便可以看到它.我希望 ImageView 在振动停止后重新设置为消失.我该怎么做?

I have an onClick method set in the xml layout file that triggers the vibration of the phone for 100ms at this point I have the ImageView Visibility set to visible so it can be seen. I want the ImageView to be set back to gone again when the vibration has stopped. How do I go about this?

推荐答案

可以同时启动这个方法:

You can start this method at the same time:

public void timerDelayRemoveView(float time, final ImageView v) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { v.setVisibility(View.GONE); } }, time); }

更多推荐

使 ImageView 在设定的时间内可见

本文发布于:2023-11-27 07:20:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637109.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间内   ImageView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!