how to make horizontal scrollview extra wide

Jondroid

Member
Licensed User
Longtime User
I have a need for an extremely wide horizontal scrollview. As I understand I have to add views to the panel property of HorizontalScrollview. So far so good, but I want a very wide panel, in fact as wide as possible. However, I have issues making the panel much wider than something in the order of 16000. The help says that I should be INT.

So my question is, how to make a horzitonalscrollview wider than about 16000 pixels?

I understand that most people might think that 16000 should be enough for all sorts of problems but in my case I really need an extremely wide panel and it should be scrollable.

Any help would be greatly appreciated.
Jon
 
Last edited:

bluejay

Active Member
Licensed User
Longtime User
You should only draw enough data to fill the screen and store the sample data elsewhere.

Maybe you can do something with the slide panels examples using two panels.

bluejay
 
Upvote 0

Jondroid

Member
Licensed User
Longtime User
Thanks bluejay, yes, I don't store the bitmaps. I just draw on the panel and keep the data seperate. But the suggestion with the sliding panels sounds very interesting indeed. That way I can probably build almost infinite long sliding panels. Let's see how that works out.
 
Upvote 0

Jondroid

Member
Licensed User
Longtime User
However, one thing i just realized is that you do not need a bitmap.
Considering, you will plot one 'x' per 'y' , you are effectively leaving more than 99% of the bitmap empty. Not only is that a waste of memory and storage, it is also a waste of bandwidth and efficiency.
It will actually be faster just to save one value per sample instead of the whole bitmap.


Sent from my GT-I9000 using Tapatalk

That's totally correct. However, internally the canvas to draw on will be a bitmap, as I understand now. So, in any case this means I won't be able to have a canvas which is larger than the maximum bitmap allowed. Based on the previous suggestion I may find a work around if I build my own kind of view.

E.g. I could have a much narrower horziontal scrollview and as soon as I reach the most left part it will replot the data from the memory and move to the right side.

That way the user experience might not be much different to a very large (almost infinite wide) horizontal scrollview. Think about this loud, I just think that this would mean that I don't need to use sliding panels.

But I will try both approaches and will see which one looks best.
 
Upvote 0

COBRASoft

Active Member
Licensed User
Longtime User
I would suggest a very old trick for 'scrolling'. Store all the x,y coordinates in a database or list or something. Make the panel twice the size of the screen in width and fetch the data required to show on the current screen + some extra pixels on both sides (1/2 left, 1/2 right). Then, after some sliding (touch event), you can redraw the whole thing in the center and fetch the next data in the background (separate thread) and repeat the whole process. The registration of the coordinates can be done by a service so it continues to store new points while scrolling.
 
Upvote 0
Top