Resize programmatically added views

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hello,

I want to resize views that were added with code so they can fit any screen.
Normally, i use the layout designer and then use the Excel document somebody provided here on the B4A forums so it will resize automatically.

Now I want to resize the views, but i'm stuck with the "%X" and "%Y".

B4X:
scrollDraw.Panel.AddView(imvImage,10,i*(imgHeight+imgSpace),imgWidth,imgHeight)
      scrollDraw.Panel.AddView(lblTitle,45,i*(imgHeight+imgSpace)+10,imgWidth,imgHeight)
      scrollDraw.Panel.AddView(lblDate,45,i*(imgHeight+imgSpace)+35,imgWidth,imgHeight)
      
      Dim leftImage, topImage, widthImage, heightImage As Double
      Dim xImage, yImage, xImage2, yImage2 As Double
      leftImage= 10
      topImage = i*(imgHeight+imgSpace)
      widthImage = imgWidth
      heightImage = imgHeight
      
      Dim strXImage, strYImage, strXImage2, strYImage2 As String
      Dim dlbx As Double
      xImage = (100*leftImage)/xPortrait
      'strXImage = xImage &"%X"
      yImage = (100*topImage)/yPortrait
      xImage2 = (100*widthImage)/xPortrait
      yImage2 = (100-heightImage)/yPortrait
      
      
      imvImage.SetLayout(xImage*1%X,yImage*1%Y,xImage2*1%X,yImage2*1%Y)

I know the "*1%X" or "*1%Y" is wrong, but I cannot add something like this:

xImage%X, yImage%Y, etc

Any help?

Tomas
 
Top