B4J Question Why are this imageview's borders flickering while moving ? Simple code.

TelKel81

Active Member
Licensed User
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    Form1.Show

    Dim ivSize As Int = 300
   
    Dim iv As ImageView
    iv.Initialize("")
    Form1.RootPane.AddNode(iv, 0, 0, ivSize, ivSize)
   
    Dim bc As BitmapCreator
    bc.Initialize(ivSize, ivSize)
    bc.DrawRect(bc.TargetRect, xui.Color_Red, False, 1)
    bc.SetBitmapToImageView(bc.Bitmap, iv)

    iv.SetLayoutAnimated(10000, 250, 250, ivSize, ivSize)
End Sub
 

William Lancee

Well-Known Member
Licensed User
Longtime User
I am not sure what you mean by 'moving'.

iv.SetLayoutAnimated(10000, 250, 250, ivSize, ivSize)

Your animation is set for 10 seconds. Is that what you really want?
 
Upvote 0

TelKel81

Active Member
Licensed User
While the view is being moved by SetLayoutAnimated, the red borders are flickering. What I really want is no flickering
 
Upvote 0

TelKel81

Active Member
Licensed User
That won't fix my issue when I'll start moving the view.

You get no flickering with the same code ?
 
Last edited:
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
On my screen it is not exactly flickering. The animation seems to use fairly large steps, which makes a bit jerky.
It definitely isn't smooth.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I tried a simpler view, with a similar effect, but not as severe.
B4X:
    Dim pnlSize As Int = 300
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetColorAndBorder(xui.Color_Transparent, 1, xui.Color_Red, 0)
    Root.AddView(pnl, 0, 0, pnlSize, pnlSize)
    pnl.SetLayoutAnimated(10000, 250, 250, pnlSize, pnlSize)
 
Upvote 0

TelKel81

Active Member
Licensed User
Jerky might be a better word to describe the issue. I'm french canadian so...

Here's a link to a clip of my problem (using my/your code).
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
That's not good. I have created many draggable objects and I have never had a problem like this.
That's probably because I handle all the redrawing/refreshing myself. Clearly the image object requires more time to refresh.
Also, the BitmapCreator functions may be slower than the Canvas drawing or native View rendering.

Other community members may know what causes this. If anyone knows more about this please respond.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…