Android Question spinner rtl

yaniv hanya

Active Member
Licensed User
Is there a way to display the designer's spinner rtl ?
And that the values be centered rather than right or left?
 

Erel

Administrator
Staff member
Licensed User
You can use CSBuilder to change the alignment. This code is from B4XPreferencesDialog:
B4X:
Dim options As List
           options.Initialize
           Dim cs As CSBuilder
           For Each opt As String In original
               options.Add(cs.Initialize.Alignment("ALIGN_OPPOSITE").Typeface(Typeface.DEFAULT_BOLD).Append(opt).PopAll)
           Next
The options are: ALIGN_NORMAL, ALIGN_OPPOSITE or ALIGN_CENTER
 

yaniv hanya

Active Member
Licensed User
Thanks
It worked fine.
But is there a way to place the opening arrow on the left?
And do you have an idea why the attached code did not work when the value of opt was "עברית"
B4X:
For Each opt As String In original       
        If opt="עברית" Then           
            options.Add(cs.Initialize.Alignment("ALIGN_OPPOSITE").Typeface(Typeface.DEFAULT_BOLD).Append(opt).PopAll)
        Else
            options.Add(cs.Initialize.Alignment("ALIGN_NORMAL").Typeface(Typeface.DEFAULT_BOLD).Append(opt).PopAll)
        End If       
    Next
it worked when the value was in English
 

Erel

Administrator
Staff member
Licensed User
But is there a way to place the opening arrow on the left?
No simple way. You can try to replace the spinner background with your own drawable. I would have used a custom view for this. It shouldn't be too complicated to create one.

And do you have an idea why the attached code did not work when the value of opt was "עברית"
Put a breakpoint and make sure that the value is actually what you expect it to be.
 
Top