Android Question The size and position with setlayout

Isac

Active Member
Licensed User
Longtime User
Hello,
I changed the position of the buttons with setLayout () on the cell S3,
but when I load the same program on a cellualre with lower resolutions, the buttons remain the same size, but the text inside the buttons is almost canceled.
Do you have any idea?

thanks
 

Isac

Active Member
Licensed User
Longtime User
I have included the log

B4X:
    TextScale = GetDeviceLayoutValues.ApproximateScreenSize/2
    lbltopright.Textsize = 3.14* TextScale
    Log(lbltopright)
    Log("Textscale="& TextScale)

(EditText): Layout not available, Text=
Textscale=1

I'm using a galxy next
 

Attachments

  • button.jpg
    12.7 KB · Views: 149
Upvote 0

klaus

Expert
Licensed User
Longtime User
Post your complete code !!!!
We are turning in circle !
B4X:
TextScale = GetDeviceLayoutValues.ApproximateScreenSize/2
    lbltopright.Textsize = 3.14* TextScale
This has nothing to do with what I posted !
If you don't want to help us helping you what do you expect.
 
Upvote 0

Isac

Active Member
Licensed User
Longtime User
Thank you all for your patience I finally solved

B4X:
    TextScale = GetDeviceLayoutValues.ApproximateScreenSize / 0.5
    btnAvvisami.Textsize = 3.14 * TextScale
    Label1.TextSize= 2.95* TextScale
    Label2.TextSize= 3.14 * TextScale
    btnData.TextSize= 3.14 * TextScale
    btnCancella.TextSize= 3.14 * TextScale
    edGiorni.TextSize= 2.1 * TextScale
 
Reactions: eps
Upvote 0

eps

Expert
Licensed User
Longtime User
Also take care with the gravity of the button text as well - this will have an impact on how it is displayed on the button.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, but this looks very strange to me.
With
Label1.TextSize= 2.95* TextScale
Label2.TextSize= 3.14 * TextScale

Two different text size adjustments for labels is strange ?
This means that the original height and / or text size are not coherent.
There can be different reasons, but without knowing what you are doing it's difficult to give any advice.
- Do you have AutoScale active in the Designer ?
- What are the backgrounds of the different views ?
- The padding can be different for different views.
etc.
 
Upvote 0

Isac

Active Member
Licensed User
Longtime User
Yes, because they also have different setLayout
Currently it works on both devices correctly.
thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…