public class myFloatView extends Activity {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button bb=new Button(getApplicationContext());
WindowManager wm=(WindowManager)getApplicationContext().getSystemService("window");
WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
/** *以下都是WindowManager.LayoutParams的相关属性 * 具体用途请参考SDK文档 */
wmParams.type=2002; //这里是关键,你也可以试试2003
wmParams.format=1; /** *这里的flags也很关键 *代码实际是wmParams.flags |= FLAG_NOT_FOCUSABLE; *40的由来是wmParams的默认属性(32)+ FLAG_NOT_FOCUSABLE(8) */
wmParams.flags=40;
wmParams.width=40;
wmParams.height=40;
wm.addView(bb, wmParams);//创建View
}
}
/** * Window type: phone. These are non-application windows providing * user interaction with the phone (in particular incoming calls). * These windows are normally placed above all applications, but behind * the status bar. */ public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2; /** * Window type: system window, such as low power alert. These windows * are always on top of application windows. */ public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有