How to make floating widgets?

with touch 1 event it seems like ok, but still
that part of the widget is out of the screen, same for the bottom side