1: change the transparency of the transparent view
2: in the view and add a TextView display text
WindowManager manager=((WindowManager) getApplicationContext () getSystemService (Context. WINDOW_SERVICE));
WindowManager. LayoutParams localLayoutParams=new WindowManager. LayoutParams ();
LocalLayoutParams. Type=WindowManager. LayoutParams. TYPE_SYSTEM_ERROR;
LocalLayoutParams. Gravity=gravity. TOP;
LocalLayoutParams. Flags=WindowManager. LayoutParams. FLAG_NOT_FOCUSABLE |
. LayoutParams. FLAG_NOT_TOUCH_MODAL |
WindowManager. LayoutParams. FLAG_LAYOUT_IN_SCREEN;
LocalLayoutParams. Width=WindowManager. LayoutParams. MATCH_PARENT;
LocalLayoutParams. Height=(int) (30 * getResources (). GetDisplayMetrics () scaledDensity);
LocalLayoutParams. Format=PixelFormat. TRANSPARENT;
View the View=new CustomViewGroup (this);
Manager. AddView (view, localLayoutParams);
CodePudding user response:
View the View=new CustomViewGroup (this); Have you this sentence is not a control, direct operation this view, to control the transparency, plus TextViewCodePudding user response:
I am a rookie, bother express code