The buttons can reposition themselves if you place them inside a Subform which is set to be Flowed.
For hiding and displaying, you need to read the XML tag value in the initialize event and set the presence property.
For example..
if(xfa.resolveNode("$record.ButtonValues.Button1").value == " hidden")
Button1.presnece = "hidden";
else
Button1.presence = "visible";
Thanks
Srini