[原创]android 状态栏显示控件-我的是监控各个app网速
做的个简单的监控流氓软件的app:
就是动态的显示各个app的上传下载网速;尤其是上传网速太大的话,就可能是流氓.
360是吗?
直接上核心源码:
}
m_v_floatView = LayoutInflater.from(getApplicationContext()).inflate(
R.layout.floatview, null);
m_tv_speed_info = (TextView) m_v_floatView
.findViewById(R.id.speed_info);
m_tv_speed_info.setText("time:" + System.currentTimeMillis());
m_vm = (WindowManager) getApplicationContext().getSystemService(
Context.WINDOW_SERVICE);
m_params = new WindowManager.LayoutParams();
m_params.format = PixelFormat.RGBA_8888;
m_params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;//TYPE_SYSTEM_ALERT;
m_params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL|
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR|
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;//helin 20130819 设置flag,这样可以到状态栏显示啦^_^
m_params.width = WindowManager.LayoutParams.WRAP_CONTENT;
m_params.height = WindowManager.LayoutParams.WRAP_CONTENT;效果:

源码:
HahaAppTraffic[2013-8-19].zip
