Advertisement
Guest User

Untitled

a guest
Jul 16th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. class MyDecorView extends FrameLayout {
  2.  
  3. Paint paint = new Paint();
  4.  
  5. public MyDecorView(Context context) {
  6. super(context);
  7. paint.setTextSize(64);
  8. paint.setColor(Color.WHITE);
  9. }
  10.  
  11. @Override
  12. protected void dispatchDraw(Canvas canvas) {
  13. super.dispatchDraw(canvas);
  14. canvas.drawColor(0x88000000);
  15. canvas.drawText("draw some text", 100, 200, paint);
  16. }
  17.  
  18. public static void addMeToTheViewTree(Activity activity) {
  19. MyDecorView mdv = new MyDecorView(activity);
  20. ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
  21. View child = decorView.getChildAt(0);
  22. decorView.removeView(child);
  23. mdv.addView(child);
  24. decorView.addView(mdv);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement