Android Question how to center dynamically image

Roberto P.

Well-Known Member
Licensed User
Longtime User
how can I center the image dynamically according to the size and orientation of the screen?
thanks you
 

Attachments

  • Immagine.png
    295.2 KB · Views: 249

eps

Expert
Licensed User
Longtime User
Work out the width and height of the screen or panel.

Divide both by 2.

You either know the height and width of the image or can work those out

Divide both by 2.

Take away from the screen numbers and then place.
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
thank you, but if I use your information, I see no picture!?

perhaps we need to subtract the width of the left panel and then do the calculation?

thanks for help
 
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
does not work!? the image is not displayed ...
I attach the file. thanks
 

Attachments

  • homepage.bal
    3.8 KB · Views: 148
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You should attach the WHOLE PROJECT not only the .bal file.

The problem I see is the ANCHORS, change the values to:
B4X:
Horizontal anchor = Left
Vertical anchor = Top
And change the ImageView width and Height to 200dip.

You can tweak that later of course.
 
Last edited:
Upvote 0

Roberto P.

Well-Known Member
Licensed User
Longtime User
okay, here's the project I'm doing my tests ....
thanks
 

Attachments

  • ActionBar.zip
    504.5 KB · Views: 193
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…