Android Question FloatLabeledEditText hint position

Mahares

Well Known Member
Licensed User
How i can change floatlabelededittext hint position to center or right?
I do not think you can change the hint position, but you can change the text position with this:
B4X:
Dim et As EditText = B4XFloatTextField1.TextField  'expose native view
    et.Gravity =Gravity.CENTER_HORIZONTAL
    et.Hint="Placez ici"   'or something like this: B4XFloatTextField1.TextField.EditTextHint="hello"
But if I am mistaken, Erel or someone else will be quick to correct
 
Last edited:

Mahares

Well Known Member
Licensed User
Starting from XUI Views v2.28 there are three fields that you can modify:
But I just did this now and it worked: It centered the hint text. Is that strange
B4X:
Dim et As EditText = B4XFloatTextField1.TextField 'expose native view  
    et.Gravity =Gravity.CENTER_HORIZONTAL
    B4XFloatTextField1.TextField.EditTextHint="First Name"
 

aletayyeb

Member
Starting from XUI Views v2.28 there are three fields that you can modify: HintLabelLargeOffsetX, HintLabelSmallOffsetY and HintLabelSmallOffsetX.

Call Update after you change them.
thanks.sorry but can u show example?for right position
 

Mahares

Well Known Member
Licensed User
It centers the text, not the hint text.
In your B4XViews example, remove the hint text from the designer, then, enter this code , you will see that it centers the hint word: First Name and also centers the B4XFloatField text.
B4X:
Dim et As EditText = B4XFloatTextField1.TextField 'expose native view
    et.Gravity =Gravity.CENTER_HORIZONTAL
    B4XFloatTextField1.TextField.EditTextHint="First Name"
 

Erel

Administrator
Staff member
Licensed User
Of course, this is a native hint which is less useful as it disappears when there is a text. This means that you still need to add a label to explain the purpose of the field.

thanks.sorry but can u show example?for right position
B4X:
B4XFloatTextField1.TextField.SetTextAlignment("CENTER", "RIGHT")
B4XFloatTextField1.HintLabelLargeOffsetX = B4XFloatTextField1.mBase.Width - 55dip
B4XFloatTextField1.HintLabelSmallOffsetX = B4XFloatTextField1.mBase.Width - 40dip
B4XFloatTextField1.Update


 
Top