B4J Question ImageView.left not work

WebQuest

Active Member
Licensed User
Hello,
I am attempting to displace an ImageView via the Left property but this has no effect. If I use SetlayoutAnimation it works. But I only need to work on the x axis. Can anyone tell me why .left doesn't work?

B4X:
Private ImageView1 As ImageView

ImageView1.left=500dip 'Not work '
 

DonManfred

Expert
Licensed User
Longtime User
why .left doesn't work?
Where is your small project showing the Problem? Hard to help without seeing what you are doing in your code
 
Upvote 0

WebQuest

Active Member
Licensed User
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private Button1 As Button
    Private ImageView1 As ImageView
End Sub

Public Sub Initialize
    
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    ImageView1.Left=300
End Sub



Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
End Sub
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Sorry, my mistake, I was testing with B4A and not with B4J.

Two options:
Either add Sleep(0) before Calling ImageView1.Left=300.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    Sleep(0)
    ImageView1.Left = 0dip
End Sub

Or add the B4XPages_Resize event.

B4X:
Private Sub B4XPage_Resize (Width As Int, Height As Int)
    ImageView1.Left = 0dip
End Sub
 
Upvote 0
Top