Bug? label text size not changed

ArminKH

Well-Known Member
hi
when i change the label text size before a while loop the text size not changed
!!!!!
please test attached sample
 

Attachments

That's a different code than the one you posted in post#1, I gave you a solution for that one.
The behaviour may change with different Android versions.
yes thank u
but as you can see at the attached sample the text size not increased or decreased in a while loop even with DoEvents
 
Last edited:
In the code you posted in post#3 there is no DoEvents.
On my device your code displays nothing.
Then I added two Logs in Activity_Create.
Code: Copy
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    Label1.Typeface = Typeface.LoadFromAssets("mitra.ttf")   
        Log(Label1.TextSize)
        Dim T8TextSize1 As T8TextSize
         T8TextSize1.Initialize
        T8TextSize1.SingleLineFitText(Label1 , False)
'        DoEvents
    Log(Label1.TextSize)
End Sub
Result: first value 14.57....
Second value 0.1406...
So it seems that your routine doesn't do what you expect.
 
In the code you posted in post#3 there is no DoEvents.
On my device your code displays nothing.
Then I added two Logs in Activity_Create.
Code: Copy
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    Label1.Typeface = Typeface.LoadFromAssets("mitra.ttf") 
        Log(Label1.TextSize)
        Dim T8TextSize1 As T8TextSize
         T8TextSize1.Initialize
        T8TextSize1.SingleLineFitText(Label1 , False)
'        DoEvents
    Log(Label1.TextSize)
End Sub
Result: first value 14.57....
Second value 0.1406...
So it seems that your routine doesn't do what you expect.
thank u klaus yes u are correct
do you know why?
because some time my getLineCount sub return 2 even if my text is 1 line(single line)
and i have not any solution for this one
as you can see this code of java not worked in that while loop and always return 0
Code: Copy
    Jo = TargetView
    Return Jo.RunMethod("getLineCount",Null)
i ask this 3 or 4 days ago but i have not answered by good solution
here is my thread about this problem
https://www.b4x.com/android/forum/threads/get-line-count-of-a-label.56790/
if is possible for u please correct me
thank u for wasting your time for my crazy question
 
Back
Top