Textsize in Spinner

manios

Active Member
Licensed User
Longtime User
I wish I could adjust the Textsize in the Spinner!
 

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Me too. Below is a screen shot of a layout for a 10.1" tablet with 1280x800 (160 dpi) resolution.
The Spinner text looks funny compared to all the other views, but that's the size I'm stuck with.

tinySpinnerPrint.jpg
 

manios

Active Member
Licensed User
Longtime User
GREAT!
Thank you!
 

akaliptos69

Member
Licensed User
Longtime User
The next version (1.6) will support setting the text size and color.

I have some reports from layouts 240x320@120dpi (HTC WildFire) that spinners not showing properly:

EOPY1.jpg


How can I fix it programmatically? I've been trying to find the TextSize Properly for the Spinner and it seems that I miss something.
 

mc73

Well-Known Member
Licensed User
Longtime User
Did you try changing the spinner.height to something big enough instead?
 

akaliptos69

Member
Licensed User
Longtime User
It cannot be done since the height and width are set by a scale factor. The problem is that the text inside the spinner is not setting accordingly. I found a solution:

spinner1.textsize = 12

but after applying that the list text size turn 12 as well causing problems. I don't have a problem with the list text size. The problem is only for the selected value appearing on the spinner.
 

mc73

Well-Known Member
Licensed User
Longtime User
It cannot be done since the height and width are set by a scale factor. The problem is that the text inside the spinner is not setting accordingly. I found a solution:



but after applying that the list text size turn 12 as well causing problems. I don't have a problem with the list text size. The problem is only for the selected value appearing on the spinner.
Perhaps then you could multiply the scale factor once, just for the spinner's height.
 

akaliptos69

Member
Licensed User
Longtime User
Yes, I used it to go on with the designing in order to cover all possible resolutions... and it works great from 320x480 up to 960x540 (those are the ones tested and confirmed ... but on smaller or larger than these it seems to have a problem... Small like the ones on my example show the layout stated above on the pic, larger needs improvement on the images (totally different discussion).
 

Roger Garstang

Well-Known Member
Licensed User
Longtime User
I had to override Font Scale in my View Manager class (In forums here) to get good results on fonts with spinners. No matter how I adjusted the size it always came up wrong. Other controls sized ok finally after much hair pulling and tweaking and work with font scaling...spinners not so much.

Get Font scale with code below and reverse the scale with dividing your text size by it:

B4X:
Dim Ref As Reflector
Dim FontScale As Float
   
   Ref.Target = Ref.GetContext
   Ref.Target = Ref.RunMethod("getResources")
   Ref.Target=Ref.RunMethod("getConfiguration")
   FontScale= Ref.GetField("fontScale")
 
Top