Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyDecorView extends FrameLayout {
- Paint paint = new Paint();
- public MyDecorView(Context context) {
- super(context);
- paint.setTextSize(64);
- paint.setColor(Color.WHITE);
- }
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
- canvas.drawColor(0x88000000);
- canvas.drawText("draw some text", 100, 200, paint);
- }
- public static void addMeToTheViewTree(Activity activity) {
- MyDecorView mdv = new MyDecorView(activity);
- ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
- View child = decorView.getChildAt(0);
- decorView.removeView(child);
- mdv.addView(child);
- decorView.addView(mdv);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement