Erel--How do I set the button text color in code? There does not seem to be a .TextColor setting. Also, is there a way to have multi-line text on a button?
Thanks
Allan
Thanks
Allan
Sub SetMultiline(b As Button)
Dim no As NativeObject = b
no.GetField("titleLabel").SetField("numberOfLines", 0)
End Sub
Note that this is not a private forum. Don't limit your questions to a single member.
See this thread: https://www.b4x.com/android/forum/threads/button-textcolor.47640/#post-295034
You can use this code to set the button to show multiple lines:
B4X:Sub SetMultiline(b As Button) Dim no As NativeObject = b no.GetField("titleLabel").SetField("numberOfLines", 0) End Sub
Sub SetMultiline(b As Button)
Dim no As NativeObject = b
no.GetField("titleLabel").SetField("numberOfLines", 0)
no.GetField("titleLabel").SetField("textAlignment", 1)
End Sub
Declaration
Objective-C
enum { NSTextAlignmentLeft = 0, NSTextAlignmentCenter = 1, NSTextAlignmentRight = 2, NSTextAlignmentJustified = 3, NSTextAlignmentNatural = 4, }; typedef NSInteger NSTextAlignment;