Listview background image

walterf25

Expert
Licensed User
Longtime User
Hello all, i just wanted to see if anyone has seen this issue, is probably not so much an issue, i have a couple of listviews on my current app and i have set a background image on the listviews, but for some reason when there's only a couple of items on the listview the background image only extends as far down as the items, here's a picture to better explain it, as you guys can see the rest of the blank space is color gray, the activity background color is black, so where's this gray color coming from. I already tried setting the background color of the listview to transparent and it still shows the gray color, i'm using a motorola Photon android 2.3.4 version, when i launch the app on the emulator everything seems fine.

screenshot1.jpg
emulatorscreenshot.jpg



thanks guys
Walter
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code should fix it according to their blog:
B4X:
Sub Globals
   Dim ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   ListView1.Initialize("")
   Activity.AddView(ListView1, 0, 0, 100%x, 100%y)

   Dim r As Reflector
   If r.GetStaticField("android.os.Build$VERSION", "SDK_INT") >= 10 Then
      r.Target = ListView1
      r.RunMethod4("setOverscrollFooter", Array As Object(Null), _
         Array As String("android.graphics.drawable.Drawable"))
   End If
End Sub
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Thanks Erel, and yes your code worked like a charm, now I noticed another issue, i'm not sure if this can be fixed the same way, but when i scroll up or down on the listview the background image disappears and the listview's background turns black, only if you click on one of the items on the list you can see the background image appear again, do you have any idea on how to fix this?

Again, thanks for your help Erel,
cheers,
Walter
 
Upvote 0

Woinowski

Active Member
Licensed User
Longtime User
Have you setup the scrolling color to transparent?
B4X:
ListView1.ScrollingBackgroundColor = Colors.Transparent
That one saved my day, too. So obvious I did not see it...:cool:
 
Upvote 0
Top