dualznz Member Licensed User Longtime User Aug 20, 2013 #1 Hi all is there anyway to center the image to be in center.horizontal on any device i have tried it via addview but it shows on the left hand side using gravity would i contain the image inside a panel then center the panel on the screen?
Hi all is there anyway to center the image to be in center.horizontal on any device i have tried it via addview but it shows on the left hand side using gravity would i contain the image inside a panel then center the panel on the screen?
NJDude Expert Licensed User Longtime User Aug 20, 2013 #2 Something like this: Code: Copy Dim myImage As ImageView myImage.Initialize("") Activity.AddView(myImage, 0dip, 0dip, 200dip, 200dip) 'Let's say the ImageView is 200x200 myImage.Left = (100%x - 200dip) / 2 myImage.Top = (100%y - 200dip) / 2 Upvote 0
Something like this: Code: Copy Dim myImage As ImageView myImage.Initialize("") Activity.AddView(myImage, 0dip, 0dip, 200dip, 200dip) 'Let's say the ImageView is 200x200 myImage.Left = (100%x - 200dip) / 2 myImage.Top = (100%y - 200dip) / 2
dualznz Member Licensed User Longtime User Aug 20, 2013 #3 excellent cheers works perfect all i needed was the left not the top and it works great cheers Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 21, 2013 #4 It is easier to do it with the designer script: Code: Copy ImageView1.CenterVertically = 50%x ImageView.CenterHorizontally = 50%y Upvote 0
It is easier to do it with the designer script: Code: Copy ImageView1.CenterVertically = 50%x ImageView.CenterHorizontally = 50%y