Android Question Custom List View Resize Stretch

Michael2150

Member
Licensed User
Hi everyone, I have custom list view and I'm resizing it with the following bit of code. The code works it resizes the panel and its clv to the exact size I need it to be, but when it resizes, all the views inside the clv stretch almost to fill the clv and then the clv shrinks to the desired size and it looks right again. It only happens for a quick second, but I was wondering if there is any setting or method I'm missing to not see that split second stretch.

Resizing ListView to size of all the items within:
    'pnlBase is the white panel that everything fits within
    pnlBase.SetLayoutAnimated(0, pnlBase.Left, pnlBase.Top, pnlBase.Width, mBase.Height - pnlBase.Top)
    
    'Sets the clv's base panel to the right size
    clvBase.SetLayoutAnimated(0, clvBase.Left, clvBase.Top, clvBase.Width, pnlBase.Height)

    'Set the clv to the size of the base
    clv.AsView.SetLayoutAnimated(0, 0, 0, clvBase.Width, clvBase.Height)
    clv.sv.SetLayoutAnimated(0, clv.AsView.Left, clv.AsView.Top, clv.AsView.Width, clv.AsView.Height)
    clv.Base_Resize(clvBase.Width, clvBase.Height)
 

LucaMs

Expert
Licensed User
Longtime User
If it is really necessary, you could use a trick: overlay a B4XImageView (or ImageView) on the pnlBase, take a snapshot of the latter, put the bitmap in the B4XImageView and only then perform the resizing (then hide or delete the B4XImageView, of course).
 
Upvote 0

Michael2150

Member
Licensed User
If it is really necessary, you could use a trick: overlay a B4XImageView (or ImageView) on the pnlBase, take a snapshot of the latter, put the bitmap in the B4XImageView and only then perform the resizing (then hide or delete the B4XImageView, of course).
It's not an app breaking problem, yet I would like to not have it. That is a bit over engineered, yet smart solution you've come up with there though. If the issue bothers me enough maybe I'd even take a look at implementing it šŸ˜‹
 
Upvote 0
Top