Hello friends of the community. Please help me. In B4A, the image will be displayed at the set size, but in B4J I have tested many ways and the image will not be displayed at the set size. Inside the attachment is a small example.
void:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private Pane1 As Pane
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")
Dim pn As Pane
pn.Initialize("")
pn.LoadLayout("ly1")
Dim Thumb As ImageView=pn.GetNode(0)
Thumb.SetImage(xui.LoadBitmap(File.DirAssets,"girl.jpg"))
'Thumb.SetImage(xui.LoadBitmapResize(File.DirAssets,"girl.jpg",400,400,True)) 'void
Thumb.Left=50 'void
Thumb.Top=50 'void
Thumb.SetSize(400,400) 'void
pn.GetNode(0).PrefWidth=400 'void
pn.GetNode(0).PrefHeight=400 'void
Thumb.Width=400 'void
Thumb.Height=400 'void
CSSUtils.SetStyleProperty(Thumb,"-fx-pref-width","400") 'void
CSSUtils.SetStyleProperty(Thumb,"-fx-pref-height","400") 'void
Pane1.AddNode(pn,0,0,400,400)
End Sub
Attachments
Last edited: