Hello,
Does anyone know why the text is not vertically centered in the view when using larger text sizes? For example an edittext with height:120; width:260: text size:130
thanks.
It appears OK here (running on Bluestacks at least) I set up an edittext as you said and set Horizontal alignment to CENTER_HORIZONTAL all in the designer.
Typeface : DEFAULT
Style : NORMAL
Horizontal Alignment : CENTER_HORIZONTAL
Vertical Alignment : CENTER_VERTICAL
Size 130
Text Color DEFAULT
It looks as I'd expect. Do you see the cursor in the middle when the edit text is empty?
You should post your code or at least a smaller project showing the problem and a screenshot of what you get and tell us what exactly you expect.
Otherwise impossible to give you any good advice.
In the example attached, we can see how the vertical centering does not work well. The red line indicates the center of the view. Initially, the text should be centered. Could depend on the level of API? I'll keep trying.
setGravity(int gravity)
Sets the horizontal alignment of the text and the vertical gravity that will be used when there is extra space in the TextView beyond what is required for the text itself.
This only has effect if there is extra space in the field, otherwise it appears as Klaus has mentioned that the characters are set to the top position and is borne out by your test app.