HorizontalScrollView snap to page?

by Jeffrey Sambells » Fri, 25 Sep 2009 22:09:45 GMT

Sponsored Links
 Is there a way to make a HorizontalScrollView "snap" to a page? Let's say I
have a hsv with an overall width of 800 but only 200 viewable. I'd like to
have the scroll position snap every 200 pixels so that the resting position
is always 200 offset from the origin (thus always displaying a full "page").
Is there an easy way to do this or do I have to somehow override the gesture


Other Threads

1. OMG.. Cyanogen berulah lagi -

busyet... dibilang 5.0.3 stable, ini keluar lagi .1 nya hahaha ampun
nih direct link: http://xrl.in/4l2e

* Slimmed down kernel by building IPv6 as a module- seems to be too
large for some devices
* Fixed USB tethering

---- 5.0.3-N1
* Kernel
* New wallpapers from Prash and SatanR1. Graphical tweaks from
* Updated Wysie's contacts
* NEON optimizations in Skia and Pixelflinger (from 0xdroid and
* Many bugfixes from AOSP, Koush, bcrook, myself, others
* Fixed backup script to properly restore Goggles
* Rebuilt the whole thing with potentially better CFLAGS
* More stuff, it's late/early


"Indonesian Android Community [id-android]" 

2. Fast way of drawing lines between two points anywhere on screen. OpenGL ES.

Hi guys,

I'm getting closer to wrapping up my game project but facing an
interesting "issue" now with the game so looking for help on how to do

I need to draw lines (lasers) in orthogonal 2D coordinate space using
OpenGL but I cannot nail down a quick way to do so. Usually I draw
everything using gl.glDrawArrays(); and it's proven to be fairly good
way of rendering everything in my tile based world. But the lasers are
giving me a headache. I need to be able to draw line between two
points and the two points can be anywhere on the screen. This makes it
next to impossible to predefine the lines. If I only had to do
horizontal / vertical lines I could easily solve this but since the
two points can be anywhere on the screen and I need to be able to draw
a line between them no matter the angle / direction.

My current implementation is a really lousy one and definitely hits
the FPS a bit too heavily.
When ever I need to draw a line between two points (which is quite
often) I call a "shoot" method that takes in two positions (start and
end of the line) and draws a line between them. It defines the
vertices everytime I call shoot.

I define them by doing the whole thing:

////////////////////////// CODE
START ////////////////////////////////////////
// PASTEBIN LINK FOR THE SAME CODE : http://pastebin.com/m4faa750b

float lineVertices[] = { pos1.x, pos1.y, pos2.x, pos.y };
ByteBuffer bb = ByteBuffer.allocateDirect(lineVertices.length * 4);
line = bb.asFloatBuffer();

////////////////////////// CODE
END    ////////////////////////////////////////

And after that I can render it using the gl.glDrawArrays(); easily.

Anyone got any better solution? Any way of predefining all the
possible lines or other fancy stuff to optimize it a bit. It's obvious
that this current implementation is horrible. Causes excessive GC and
just slows things down.

So looking ways of drawing simple lines between two arbitary points on
screen as fast as possible because it happens often.


3. question about bluetooth

4. Non-parallel construction of DatePicker and TimePicker

5. ContentProvider design question!

6. Google Maps with Navigation

7. Help with speech recognition