Android Question Trying to create a box with labels

rkmoray

Active Member
Licensed User
Longtime User
In my new app, I Am using an ocr (works great), but to give the user a visual target,I am using labels to create a large transparent box.
The box look great on the emulator, but when I run it on a phone(6.1 O.S), I get the following visual seen in the attachment. as you can see, the right side is not in alignment.



Activity.AddView(l2,8%x , 8%y,4dip,70%y)'left
Activity.AddView(l3, 8%x ,8%y,50%y, 4dip)'top
Activity.AddView(l4, 90%x ,8%y, 4dip, 70%y) 'Right
Activity.AddView(l5, 8%x,78%y,50%y, 4dip)'bottom
 

Attachments

  • Screenshot_2018-04-03_083102.jpg
    Screenshot_2018-04-03_083102.jpg
    144.9 KB · Views: 285

DonManfred

Expert
Licensed User
Longtime User
As far i can see it looks OK.
The - additional EDGE part of the Screen - does not belong to the Activity. The EDGE room can not be used within a App without having a Library for this Samsung specific Feature.
If you remove the EDGE on the right side then you´ll see that the left and right margin are the same.
 
Upvote 0

rkmoray

Active Member
Licensed User
Longtime User
What can I do to solve this issue, so the box looks proper, no matter what phone is used?
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
I don't understand the logic in your code:
B4X:
Activity.AddView(l2,8%x , 8%y,4dip,70%y)'left
Activity.AddView(l3, 8%x ,8%y,50%y, 4dip)'top
Activity.AddView(l4, 90%x ,8%y, 4dip, 70%y) 'Right
Activity.AddView(l5, 8%x,78%y,50%y, 4dip)'bottom
For the top and bottom lines you set the width to 50%y, why %y and not %x?
Then, you position the right line at 90%x, this is wrong!

This code works:
B4X:
Activity.AddView(l2, 8%x , 8%y, 4dip, 70%y)'left
Activity.AddView(l3, 8%x , 8%y, 84%x, 4dip)'top
Activity.AddView(l4, 92%x - 4dip ,8%y, 4dip, 70%y) 'Right
Activity.AddView(l5, 8%x, 78%y - 4dip, 84%x, 4dip)'bottom

upload_2018-4-4_9-26-12.png
upload_2018-4-4_9-25-51.png


But why don't you use a transparent Panel and set its border size and color.

You could also add the Panel in the Designer and use anchors.
 

Attachments

  • upload_2018-4-4_9-25-4.png
    upload_2018-4-4_9-25-4.png
    5.1 KB · Views: 269
Upvote 0
Top