Android Handler 定时一分钟显示和延迟显示

private static final  int MSG_TIME_1MIN =1;
private static final int MSG_TIME_1S =2;

pressure_ll = (LinearLayout) mEnginePressureLayout.findViewById(R.id.pressure_ll);
pressure_ll.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Log.i(TAG, "pressure_ll");
        pressure_ll.setVisibility(View.GONE);
        engine_ll.setVisibility(View.GONE);
        //mHander.removeMessages(MSG_TIME_1MIN);//延迟1m
        mHander.sendEmptyMessageDelayed(MSG_TIME_1MIN,60000);//一分钟显示
    }
});
Handler mHander = new Handler(){
super.handleMessage(msg);
switch(msg.what){

case MSG_TIME_1MIN:
isMessage();
 break;

//case MSG_TIME_1S:
//if(engine_ll.getVisibility()==View.VISIBLE){
   // engine_ll.setVisibility(View.GONE);
   // pressure_ll.setVisibility(View.VISIBLE);
//}else{
    //engine_ll.setVisibility(View.VISIBLE);
    //pressure_ll.setVisibility(View.GONE);
//}
//mHander.sendEmptyMessageDelayed(MSG_TIME_1S,1000);
 //break;

}

}
private void isMessage(){//一分钟显示
engine_ll.setVisibility(View.VISIBLE);
engine_ll.setClickable(true);
}
 

你可能感兴趣的:(Android Handler 定时一分钟显示和延迟显示)