Make ImageView visible for set amount of time

两盒软妹~` 提交于 2020-01-11 10:37:30

问题


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?


回答1:


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); 
}


来源:https://stackoverflow.com/questions/4795264/make-imageview-visible-for-set-amount-of-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!