美文网首页
WindowManager

WindowManager

作者: 森码 | 来源:发表于2016-02-18 18:36 被阅读50次

看了秋大的一些源码,记录一下。

private void showTestToast() {   
 if (toastView == null) {        
     toastView = View.inflate(this, R.layout.pop_view, null);       
     simpleTxt = (TextView) toastView.findViewById(R.id.pop_view_text);   
     toastView.setOnClickListener(this);  
  }   
 simpleTxt.setText("this is a simple text");   
 int w = WindowManager.LayoutParams.MATCH_PARENT;    
 int h = WindowManager.LayoutParams.WRAP_CONTENT;   
 int flag = 0;   
 int type = WindowManager.LayoutParams.TYPE_TOAST;    
 WindowManager.LayoutParams params = new WindowManager.LayoutParams(w, h, type, flag, PixelFormat.TRANSLUCENT);    
 params.gravity = Gravity.CENTER;   
 mWindowManager.addView(toastView, params);}

同时看了windowManager的高端知识,以后过来回顾。

相关文章

网友评论

      本文标题:WindowManager

      本文链接:https://www.haomeiwen.com/subject/oiwmkttx.html