Android Question [SOLVED] Hint text Italic-Typeface

AHilberink

Active Member
Licensed User
Longtime User
Hi,

Is it possible to make the Hint text in Italic Typeface?

Kind regards,
André
 

Mahares

Expert
Licensed User
Longtime User
Is it possible to make the Hint text in Italic Typeface?
You do not specify what hint text for. I am guessing you are asking about B4XTable search hint text since you have another thread regarding B4XTable. If that is the case, then
B4X:
Dim tf As Typeface
    tf = tf.CreateNew(Typeface.DEFAULT_BOLD, Typeface.STYLE_ITALIC)
    Dim fnt As B4XFont=xui.CreateFont(tf,30)
    B4XTable1.SearchField.HintFont=fnt      'change hint text font
    B4XTable1.SearchField.Update
Don't rush to ask questions. You need to give more details; otherwise people will be guessing as to the what the question is about.
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
You do not specify what hint text for. I am guessing you are asking about B4XTable search hint text since you have another thread regarding B4XTable. If that is the case, then
B4X:
Dim tf As Typeface
    tf = tf.CreateNew(Typeface.DEFAULT_BOLD, Typeface.STYLE_ITALIC)
    Dim fnt As B4XFont=xui.CreateFont(tf,30)
    B4XTable1.SearchField.HintFont=fnt      'change hint text font
    B4XTable1.SearchField.Update
Don't rush to ask questions. You need to give more details; otherwise people will be guessing as to the what the question is about.

Sorry for not specifing. The question was about Edittext. There is no HintFont for this one, so I didnot succeed in using your code.
Do you have a solution for this?
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
Try this:
Create a CSBuilder with the typeface you like.
Set it with:
B4X:
Dim cs As CSBuilder
cs...
Dim jo As JavaObject = EditText1
jo.RunMethod("setHint", Array(cs))

I tried it with:
B4X:
            Dim cs As CSBuilder
            cs.Initialize.Color(Colors.Red).Append("Hello World!").Typeface(Typeface.CreateNew(Typeface.DEFAULT,Typeface.STYLE_ITALIC)).PopAll
            Dim jo As JavaObject = edtUrenTbl
            jo.RunMethod("setHint", Array(cs))

The text is correct, the color Red is working, but not the Typeface. Is there something wrong in my code?
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
I tried it with:
B4X:
            Dim cs As CSBuilder
            cs.Initialize.Color(Colors.Red).Append("Hello World!").Typeface(Typeface.CreateNew(Typeface.DEFAULT,Typeface.STYLE_ITALIC)).PopAll
            Dim jo As JavaObject = edtUrenTbl
            jo.RunMethod("setHint", Array(cs))

The text is correct, the color Red is working, but not the Typeface. Is there something wrong in my code?

I found the problem. I had to do .Append("") after the Typeface. It works like charm now. Thanks.
B4X:
            Dim cs As CSBuilder
            cs.Initialize.Color(Colors.Red).Typeface(Typeface.CreateNew(Typeface.DEFAULT,Typeface.STYLE_ITALIC)).Append(edtUrenTbl.Hint).PopAll
            Dim jo As JavaObject = edtUrenTbl
            jo.RunMethod("setHint", Array(cs))
 
Upvote 0
Top