Android Question Resize panel does not resize bitmap

tsteward

Well-Known Member
Licensed User
Longtime User
I am using SimpleMediaManager to load an image onto a panel that is declared as a b4xview.

When I resize the panel the image does not resize with it. I need it to.

Assign the image
B4X:
Private Sub ShowMedia (Result As MediaChooserResult)
    If Result.Success Then
        smm.SetMediaFromFile(PanelBase, Result.MediaDir, Result.MediaFile, Result.Mime, Null)
    Else
        'Panel1.RemoveAllViews
    End If
End Sub

Resize like this
B4X:
Private Sub btnZoomOutHor_Click
    PanelBase.SetLayoutAnimated(0,PanelBase.Left,PanelBase.Top,PanelBase.Width - zoomFactor,PanelBase.Height)
End Sub

Private Sub btnZoomInHor_Click
    PanelBase.SetLayoutAnimated(0,PanelBase.Left,PanelBase.Top,PanelBase.Width + zoomFactor,PanelBase.Height)
End Sub

Private Sub btnZoomOutVert_Click
    PanelBase.SetLayoutAnimated(0,PanelBase.Left,PanelBase.Top,PanelBase.Width,PanelBase.Height - zoomFactor)
End Sub

Private Sub btnZoomInVert_Click
    PanelBase.SetLayoutAnimated(0,PanelBase.Left,PanelBase.Top,PanelBase.Width,PanelBase.Height + zoomFactor)
End Sub
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
Maybe I don't understand you completely, but in the main properties you can turn automatic resizing on or off. So if you don't resize the main, but only a panel, then that is not a resize of the main. You will have to do that yourself in that case.
1735670713349.png
 
Upvote 0

MicroDrie

Well-Known Member
Licensed User
Longtime User
My solution was to put a B4XImageView onto the panel and resize that with the panel
You have now linked the B4XImageView (the child) to the panel (the parent) which, according to the Common properties, recalculates the dimensions based on the vertical and horizontal Anchors. You can deviate from this (or even confuse it) by using a script in the Common Properties. Sometimes it also helps to force the screen display to refresh with a sleep(0) command.
 
Upvote 0
Top