TDLR; I WANT TO AUTOMATIZE CENTER ALIGNMENT OF MULTI LINE TEXT AREA
Hi!
Is it just me or does it feel impossible to automatically determine the vertical center of a multi line text area?
I would like to achieve a universal center alignment for a multi-line TextArea. I am developing for multiple devices with very different screen sizes. Simply put, my goal is to make sure that the center is truly the center. I can easily do this if the text is single-line by calculating the fontHeight and shifting it negatively from half of the screen height. However, when the mentioned text becomes multi-line on a device, using half the font size for the shift is no longer accurate. I would like to automate this process somehow, maybe by determining how many lines a TextArea will have on a given screen, or finding out the height of the TextArea itself, or any other method. I tried setting the justification to Graphics.TEXT_JUSTIFY_VCENTER, which centers the text vertically, but it right-aligns the text.
Is there a way to automate this?