标签:
WindowManger wm =(WindowManger)context.getSystemService(Context.WINDOW_SERVICE); View view = Toast.makeText(context,text,Toast.LENGTH_SHORT).getView(); //设置布局参数 WindowManger.LayoutParams params = new WindowManger.LayoutParams(0; params.height = WindowManger.LayoutParams.WRAT_CONTENT; params.width = WindowManger.LayoutParams.WRAT_CONTENT; params.format = PixelFormat.TRANSLUCENT; //设置进入退出动画效果 params.windowAnimations = R.style.anim_view; params.type = WindowManger.LayoutParams.TYPE_TOAST; params.flags = WindowManger.LayoutParams.FLAG_KEEP_SCREEN_ON|WindowManger.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManger.LayoutParams.FLAG_NOT_TOUCHABLE; params.gravity = Gravity.CENTER_HORIZONTAL: params.y = 250; //显示 wm.addView(view,params); //一段时间后隐藏,一段时间后调用 wm.removeView(view);
标签:
原文地址:http://www.cnblogs.com/spring87/p/5384581.html