Android Question ScrollView grandparent panel flashes

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I have a scrollview which is dynamically added to a panel (panel2). Panel2 is a child of panel1 (panel2 was added to panel1 in the designer).

Panel1 is the outermost panel. Panel2 is a child of panel1. And the scrollview is a child of panel2.

I populate the scrollview with 10 labels. It scrolls as expected. But when it scrolls, panel1 "flashes" between its background color (white) and transparent as the scrollview scrolls.

Panel2 is the parent of the scrollview. Its background color is black. It creates a border around the scroll view. It does not seem to flash, although it's difficult to tell. The background colors of the scrollview and scrollview.panel are white.

My guess is that redrawing of the scrollview is the root cause of the flashing. But why would panel1 flash? Is there any way to prevent this?

Thanks,
Barry.
 
Hello,
Thanks, very helpful.

Using your demo, without modification, I don't get the flashing when I scroll the scrollview.

I made some modifications to your demo, one by one, to make it look more like my App that's experiencing problems. Everything was good with no flashing until I added the last piece, the mapview from OSMDroid. There are no errors in OSMDroid, but it adds a view (probably a panel at it's lowest level) on top of the Activity. Panel1 is then on top of the mapview.

I found that if I scroll the underlying map (seemed like back and forth was worse than up and down, but that doesn't make any sense) then scroll the scroll view, sometimes the Panel1 would become transparent. The text area of the checkboxes would also show as transparent (I think they are transparent already).

I could get the Panel1 to become white opaque again by clicking on it or scrolling the scrollview again.

This is similar to how my App performed except that the Panel would flash between being opaque and transparent rather than becoming steadily transparent.

I have attached my slightly modified version of your demo. Note that it uses the OSMDroid library from Warwound. You might not have this installed. You can download version 3.60 from:
http://www.b4x.com/android/forum/threads/osmdroid-mapview-for-b4a.16309/

I would be interested to see if you experience the same symptoms.

Thanks,
Barry.
 

Attachments

Upvote 0
I tried but I do not see flaws.

Sorry, I do not know how to help you :(

Thanks. You do not see errors when you test?

I wonder if it was because of the phone I am using? I was testing using a new Nexus 5, Android 4.4.2. I will have to test on some other phones.

Can I ask what device you are using? Android version?

Barry.
 
Upvote 0
No, I have not had any problems.
An unknown italian smartphone (probably made in china :)).
S.O. 4.0.4

Yep. Just tried it on my LG and did not see any flickering.

LG-P500h (I think it's called an Optimus) / Android version 2.2.1

This is my $35 USD phone from eBay ;)

I will have to get a hold of some other devices to give it a try.

Barry.
 
Upvote 0
I will have to get a hold of some other devices to give it a try.
Barry.

Ha! Figured it out.

I tried six different devices two older phones: (OS ver around 2.2 and 2.3), two newer phones (OS 4.0 and 4.4), and two tablets (OSs around 4.0). The two older phones work properly – the scrollview scrolled without the parent panels flickering. The two newer phone's and both tablet's scrollview parent panels flickered as I scrolled the scrollview.

The solution was to make the parent of the scrollview the Activity. I calculated the position of the scrollview referenced to the activity and set enabled / visible true and did BringtoFront.

Now the scroll view scrolls with no parent and grandparent panel flickering. :D

Barry.
 
Upvote 0
(but we'll never know why it works on some devices and not on others!)

I'm going to take a guess here…

I will bet it has something to do with hardware acceleration for the display. The two older devices where it originally worked are probably old enough so that they don't have hardware acceleration for the display. The newer devices probably do have hardware acceleration.

When hardware acceleration first came out for Windows PCs quite a few years ago there was a similar problem where some subtle graphics redrawing worked on non-accelerated PCs but not on accelerated PCs. I am pretty sure the problems with PCs are all fixed now.

Barry.
 
Upvote 0
Back
Top