How to make a floating button on android studio which can be moved like facebook messenger and can open a new window when clicked

I want to make a floating button and which can be dragged across screen on android. And also I want to expand it to a window when clicked which has a calculator.
I have seen some posts that do the trick, but the problem is that everything is coded in java, I want the calculator window to be defined in xml resource file