Android Question FloatLabeledEditText hint position

Solution
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

B4A_rm8k02LU0N.png


B4A_1Y02oLFFs9.png

Mahares

Expert
Licensed User
Longtime 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:
Upvote 0

Mahares

Expert
Licensed User
Longtime 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"
 
Upvote 0

Mahares

Expert
Licensed User
Longtime 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"
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime 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

B4A_rm8k02LU0N.png


B4A_1Y02oLFFs9.png
 
Upvote 0
Solution
Top