Android Question text at the labels and buttons are wrapped in different screen sizes

Baris Karadeniz

Active Member
Licensed User
I have a very simple view app. There are labels and buttons. And tere are texts on them. I added all labels and buttons in the designer. And I used horizontal anchors for labels and buttons.

I used AutoScale and AutoScaleRate in the designer. Labels and buttons are ok but the texts on them are wrapped at the different screen sizes (UI Cloud). How can I solve this problem? Why AutoScaleRate doesn't work for the texts? I searched forums, there are many complicated solutions. Can anyone give a simple solution for this problem? Just the text should fit on the label and buttons.

Designer script;

B4X:
'All variants script
AutoScaleRate(0.3)
AutoScaleAll
 

klaus

Expert
Licensed User
Longtime User
The problem is that you use a specific layout variant (357 x 667 scale = 1).
You should use the standard layout variant (320 x 480 scale = 1).
Try to use a AutoScaleRate a bit less than 1.
The TextSize for the Buttons is too big, or you should change their Padding, margins.
 
Last edited:
Upvote 0

Baris Karadeniz

Active Member
Licensed User
When I change the layout variant to 320x480 scale=1, there is still problem at Nexus 4 Material and Samsung Pocket at the UI Cloud. May be at different screen sizes too. I used AutoScaleRate = 1. Because if I use 0.3, there happens problem at the other screens too. Is there any other better way to do this?
 
Upvote 0

Baris Karadeniz

Active Member
Licensed User
I did as you said. But there is still problem at some screen types. Zip file is given attached. Can you please help what can I do?
 

Attachments

  • TaksimDriver17B4A.zip
    27.1 KB · Views: 136
Upvote 0

klaus

Expert
Licensed User
Longtime User
Some comments:
Example on PanelStatus you have a Button on top called lblTabStatus ? Do you need a Button or a Label.
In this Button the text is not displayed correctly on my device.
If you replace it by a Label the text is OK on my device.
This Button covers the whole width, then you have another Button BtnStatusBack at the Left overlapping lblTabStatus !?
As I already told you the TextSize for your Buttons is too big for their height, or the height is too small for their text size.
Buttons and EditText views have a padding (margins at each edge), Labels don't.
I'm afraid that there is another problem.
You don't display the title bar, which means that the screen size is a bit higher, I'm not sure if AutoScale takes this into account.

Attached a small projet showing the problem.
In the picture below you see the effect of the padding.



I remove the padding of btnTest2 in the code and you see the difference.
btnTest3 hase a height of 40dip, the text is displayed correctly for this height.

 

Attachments

  • LayoutTest.zip
    7.9 KB · Views: 149
Upvote 0

Baris Karadeniz

Active Member
Licensed User
Thanks, I will try them. One question, there are buttons (Status, Map, ....) at the PanelMain. Their height is 35 and font size is 15 and there is not any problem for them. Can you see them correctly in your device? lblTabMain is a button also (and you are right it should be label) and its height 30 and font size is 14 but there is a problem. 35,15 no problem but 30,14 is a problem. What do you think?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, the answer in my previous post was for the Designer with the default layout variant.
Now, I checked on device running the program and the texts are OK with Height 35, TextSize 15, AutoScaleRate(1) and AutoScale.
I don't have a device with the 'standard' screen size.

 
Upvote 0

Baris Karadeniz

Active Member
Licensed User
User can exit app by pressing bottom middle button of the phone. App will still run at the background. All phones don't have this middle button? Should I use back key button to leave Panel Main too?

User has to kill or force stop to leave app totally if he don't want app to run at the background too. In this case commands will be lost.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…