I have following code to add and place image to activity
B4X:
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
Dim xui As XUI
Dim bmp As B4XBitmap = xui.LoadBitmapResize(File.DirAssets,"kiwi.png",100dip,100dip,True)
Dim p As B4XView = xui.CreatePanel("")
Activity.AddView(p,X-50dip, Y-50dip,100dip,100dip)
p.SetBitmap(bmp)
Sleep(2000)
p.SetLayoutAnimated(1000,X-5dip,Y-5dip,10dip,10dip)
End Sub
How to keep the image reduce in size and keep the ratio while using SetLayoutAnimated ?
For an app that should run on Android and iOS an animation effect is needed. A fullscreen image shall get an alternating zoom in/out animation. It is expected that after a continuous zoom-in the image stands for a short time and then zooms out again continuously. This is solved in principle by...
I think i can manage this with different approach, for this purpose using ImageView is the solution.
Here is my working code:
B4X:
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
If Action = Activity.ACTION_DOWN Then
Dim xui As XUI
Dim bmp As B4XBitmap = xui.LoadBitmapResize(File.DirAssets,"kiwi.png",100dip,100dip,False)
Dim c As ImageView
c.Initialize("")
c.SetBackgroundImage(bmp)
c.Gravity = Gravity.FILL
Activity.AddView(c,X-50dip, Y-50dip,100dip,100dip)
Sleep(2000)
c.SetLayoutAnimated(1000,X-5dip,Y-5dip,10dip,10dip)
End If
End Sub