在Android中一段时间​​后隐藏TextView [英] Hide TextView after some time in Android

查看:32
本文介绍了在Android中一段时间​​后隐藏TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一段时间间隔比如 3 秒后隐藏 TextView.我用谷歌搜索并找到了一些代码,我尝试了如下所示的代码,但它不起作用.

请告诉我这是什么问题?

I want to hide TextView after some time interval say 3 seconds. I googled and found some code and I tried code as shown below but It is not working.

Please tell me what is the wrong with this ?

tvRQPoint.setText("+0");
tvRQPoint.postDelayed(new Runnable() {
    public void run() {
        tvRQPoint.setText("+0");
    }
}, 3000);

还有一件事,如何消除 timeout ?当我在 ListViewclick 事件中使用它时,如果用户单击一个选项,然后单击第二个选项,则 3 秒后过去(单击第一个选项后), 3 秒内不显示第二个选项.

One more thing, how to remove timeout ? As I am using this on click event of ListView, If user clicks on one option and then clicks on second option, then as 3 seconds got over (after clicked on first option), It does not show second option for 3 seconds.

推荐答案

试试 View INVISIBLEGONE like:

try View INVISIBLE or GONE like:

tvRQPoint.postDelayed(new Runnable() {
public void run() {
    tvRQPoint.setVisibility(View.INVISIBLE);
}
}, 3000);

使用 view.setVisibility(View.INVISIBLE|View.VISIBLE|View.GONE);

这篇关于在Android中一段时间​​后隐藏TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆