EditText Hint and Gravity

enonod

Well-Known Member
Licensed User
Longtime User
With regard to EditText View, it seems that using Gravity with Hint Text causes the Hint Text to be obscured somehow. I cannot see that I have done anything wrong and have tried it in reverse order to no avail.
Removing Gravity cures the problem.
Any suggestions please or is it a bug?

B4X:
eName.Initialize("")
eName.Hint="Enter Name"
eName.Gravity=Gravity.CENTER
 

mangojack

Well-Known Member
Licensed User
Longtime User
enonod .. not seeing any problem here ..
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
I now agree with you, however, I placed the code out of context. In fact the code I posted is called from a sub which contains the preceding code...
B4X:
eName.InputType=eName.INPUT_TYPE_TEXT
and it is that which is causing the problem, which disappears when it is commented out. The problem can also be solved by removing the Gravity, which is what threw me.
So unless I have really got into a twist the problem exists, caused by something else but cured either way.
[EDIT]I also notice that using Gravity as shown the text is centred horizontally but is above centre vertically.
 
Last edited:
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Bump.
To bring this together...
eName is a Global EditText.
The following hides the Hint message but removing either line 2 or line 4 solves it. I presume this is not by design and I find nothing suggesting the order is critical. Is it a bug or me?

B4X:
eName.Initialize("")
eName.InputType=eName.INPUT_TYPE_TEXT
eName.Hint="Enter Name"
eName.Gravity=Gravity.CENTER
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
enonod .. is the EditText created in Designer or by Code

I Have a Layout with a single EditText 'eName' , by removing the eName.Initialize line everything is OK ?

B4X:
Sub Globals
   
   Dim eName As EditText

End Sub
   
Sub Activity_Create(FirstTime As Boolean)
    
   Activity.LoadLayout("main")
  
' eName.Initialize("")       ... not needed
eName.InputType=eName.INPUT_TYPE_TEXT
eName.Hint="Enter Name"
eName.Gravity=Gravity.CENTER

End Sub

If I include the initialize line I get the same problem that you are reporting ..
Hope this helps

Cheers mj
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
I don't use designer this is code and so initialize is required.
I presume that otherwise you get the same as me.
[Edit] sorry did not see the bottom of your post. Thanks for testing. I'll leave it a bit longer and see if Erel turns up.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
Yes! This post occurred before, and gave rise to the bug report, once it had been confirmed.
 
Upvote 0
Top