scrollView Question?

ozgureffe

Member
Licensed User
Longtime User
Is it possible to set all scrollview innerpanel elements with the same backgound image.

Then put some other images (which have transparent backgounds but have some drawings) on this backgrounds...

B4X:
    For i = 0 To Bitmaps.Size - 1
        Dim iv As ImageView 'create an ImageView for each bitmap
        iv.Initialize("")
        Dim bd As BitmapDrawable
        bd.Initialize(Bitmaps.Get(i))
        iv.Background = bd 'set the background of the imageView.
        scrl_allNotes.Panel.AddView(iv, 30, 120  + i * 60, 480, 40)
    Next

as it is seen in the code above we are already using background property to set images in every row... Then how can I we overlap two images (one of them transparent mostly)?
 

ozgureffe

Member
Licensed User
Longtime User
You can put a second ImageView or a Panel on top of the previous Imageviews.

Best regards.


Thank you klaus,
But at that time i had to initialize same images many times.
My list is already containing more than 50 images.
And more 50 for backgrounds. At total = more than 100 images. I dont want app to become so source hungry.

Is there any way of using same imageview as an element of scrollview many times ?

B4X:
        '###Header Of ScrollView
        Dim h_iv As ImageView 
        h_iv.Initialize("") 
        Dim h_bd As BitmapDrawable
        h_bd.Initialize(LoadBitmap(File.DirAssets, "allnotesheader.png"))
        h_iv.Background = h_bd 
        scrl_allNotes.Panel.AddView(h_iv, 0, 0, 480, 120)
    
    For i = 0 To Bitmaps.Size - 1 '###size of bitmap is more than 50
    
        '###Repeating Elements That Will Be Used As Backgrounds
        Dim s_iv As ImageView 
        s_iv.Initialize("") 
        Dim s_bd As BitmapDrawable
        s_bd.Initialize(LoadBitmap(File.DirAssets, "notelistsatir.png"))
        s_iv.Background = s_bd 
    
        '###Rows Of Bitmap Files That Will Be Used As Foreground Layer
        Dim iv As ImageView
        iv.Initialize("")
        Dim bd As BitmapDrawable
        bd.Initialize(Bitmaps.Get(i))
        iv.Background = bd 
        scrl_allNotes.Panel.AddView(s_iv, 0, 120  + i * 40, 480, 40) '###Background Layer
        scrl_allNotes.Panel.AddView(iv, 30, 120  + i * 40, 480, 40)  '###Foreground Layer
    Next
 
Last edited:
Upvote 0
Top