Android Question centering imageview on device

dualznz

Member
Licensed User
Longtime User
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?
 
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
Back
Top