Android Question How to remove a panel of the scrollview

Adam888

Member
Licensed User
Longtime User
Hi

I use a scrollview and add some pictures on it.Then, I want to remove a panel from the scrollview.
the code is
B4X:
    For i = 0 To Bitmaps.Size - 1
        Dim iv As ImageView 'create an ImageView for each bitmap
        iv.Initialize("") 'not interested in any events so we pass empty string.
        Dim bd As BitmapDrawable
        bd.Initialize(Bitmaps.Get(i))
        iv.Background = bd 'set the background of the image view.
        'add the image view to the scroll bar internal panel.
        ScrollView1.Panel.AddView(iv, 5dip, 5dip + i * 200dip, ScrollView1.Width - 10dip, 190dip)
    Next

I try to use ScrollView1.Panel.RemoveViewAt(2) to remove the 2nd picture. It was removed.
The views become -> 0,1,3,4,5 (It's OK)
but the bitmaps become -> 0,1,NULL,3,4,5 . So, when user scroll the scrollview, It has a blank region on the original view(2) location. Can I remove the blank region at I remove the view at the same time?
please see attached picture. Thank You.
 

Attachments

  • removescroll.jpg
    removescroll.jpg
    38.4 KB · Views: 174

derez

Expert
Licensed User
Longtime User
I tried it and it doesn't happen to me.
Try to invalidate the panel after removal of the view.
 
Upvote 0
Top