Android Question sizing issue on LG G2

RichyK68

Active Member
Licensed User
Longtime User
Hi,

I don't know if this is an issue relating specifically to the LG G2, but I would've thought that the code

[ code ]
buttonThisIsMyCamera.Left = 10%x
buttonThisIsMyCamera.width = 80%x
[ /code ]

would center the button horizontally, starting 10% into the screen and being 80% wide, with a 10% margin at the right. Correct?

The result I get is the button has a left margin but has no right margin at all. If I write similar code in the designer script area, and upload to the ui cloud, it looks fine in the results that come back, but I don't get those results on my device. This, of course, makes laying a screen very very difficult.

Any ideas?

Thanks,

Richard
 

RichyK68

Active Member
Licensed User
Longtime User
Sadly not on my G2, but it works on other devices. It's like the G2 is telling Android the screen is wider than it really is (if I make the width 70%x it looks pretty good, but only on the G2).
 
Upvote 0

RichyK68

Active Member
Licensed User
Longtime User
I've copied the layout to a brand new project and tried it on there, and it works perfectly. In the project it comes from, it doesn't work at all. On the line that reads Activity.Loadlayout("Start"), when I step over that line, the layout loads on my phone and it's already wrong. What project or activity properties could do this? The .bal file works in another project.

Thanks,

Richard
 
Upvote 0

RichyK68

Active Member
Licensed User
Longtime User
Before the Loadlayout it calls a method ShowOverLockScreen which does this

B4X:
r.Target = r.GetActivity
r.Target = r.RunMethod("getWindow")
Dim flag AsInt = Bit.OR(Bit.OR(Bit.OR(MyFunctions.FLAG_SHOW_WHEN_LOCKED, MyFunctions.FLAG_TURN_SCREEN_ON), 0), MyFunctions.FLAG_FULLSCREEN)
flag = Bit.OR(flag, MyFunctions.FLAG_ACTIVITY_SINGLE_TOP)
flag = Bit.OR(flag, MyFunctions.FLAG_DISMISS_KEYGUARD)
r.RunMethod2("addFlags", flag, "java.lang.int")

It's the FLAG_FULLSCREEN doing it but I don't know why that would change the width (1080) to something even greater, it should only change the height (because you lose the activity title bar).

Richard
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…