Is it possible to adjust the position or font size of a field in the layout.xml at runtime?
Is it possible to adjust the position or font size of a field in the layout.xml at runtime?
Yes. You can use View.findDrawableById()
to get the drawable, and then you can use methods of the Drawable
interface to manipulate it.
function moveDrawable(id as String, offsetX as Numeric, offsetY as Numeric) as Void { var drawable = self.findDrawableById(id); if (drawable != null) { drawable.setLocation(drawable.locX + offsetX, drawable.locY + offsetY); } }
Thanks, how about changing font size on the fly?
I found this simple solution works
var field= View.findDrawableById("field") as Text;
field.locX = 150;