Trying to set the text for a button to show on two lines using \n but it is not working...
This works on the emulator.
What are you testing on. The two lines do not appear in the Designer. You have to run the Project and place the set Button code in an event handler like a Button or Screen1.Initialize.
You can also set several lines using the Button Properties in the Designer.
If you are testing on real device then maybe it is a bug because it is also reported some time before in some samsung device.
Yes, I'm testing on Samsung Galaxy 9 running Android 10, and its not working.
See here:
@Anke and @Nujj can you please tell me the value of this block from the given testing extension...
Block
Extension
com.appybuilder.preetvadaliya_ict18.TestInputType.aix (5.8 KB)
I notice that sometimes manufacturers change the default input type of the text view and Samsung is one of them I have also seen this many times StackOverflow.
if the input type is set to TYPE_TEXT_VARIATION_PERSON_NAME then it does not allow multiline support.
here you can see in
The code in post #2 works also on an Samsung Tab A with Android 8.1 using either Classic or DeviceDefault or Dark or DarkTitleText Themes. If you use Classic Theme on your Android 10, do you see multiple lines?
Similarly tested on Android 10 and Android 12 (Google Pixels) in all four themes and \n
wroks to make two lines on a button. If it doesn't work on Samsung then, then it is likely to be a Samsung device/software issue as mentioned by @preetvadaliya
Samsung Galaxy Note8 - Android 9 (~ Galaxy S8):
Theme: Device Default
This also works on a Galaxy Note8 (Android 9):
Then on which devices it is not working?
I have 17 test devices (Android 4.x, 5.x, 7, 8.x, 9, 10, 11, 12). It is working on all of them exept the Samsung Galaxy Note8 (Android 9).
And what is the out put value of the block in Samsung Galaxy note8 (Android 9)? Is it 0 or something else?
Maybe it will work because developer changed input type of textview from Person name to normal text or none so it support \n.
The point is that we have not set the input type of textview for button and label components in app inventor so they are still using default set by manufacturer, if the value is different on Samsung galaxy note8 then we need to forcefully change the input type of textview which solve the problem on devices behave like samsung galaxy note8 and for other device behaviour will be same as previous.