Just do the scrolling yourself.  You are going to need to do some
significant optimizations to be able to efficiently draw a board that size
anyway (checking update rects and such to minimize drawing); to have smooth
scrolling, you may well need to do more than that, such as having it
rendered in an off-screen bitmap and only updating the tiles on the edges as
you scroll.

I typically think that, if you are writing a game, stick it in one View (or
SurfaceView if appropriate) and do the work yourself.  The view hierarchy
gives you little advantage for a game.

If you do want to try the approach of a ScrollView kind of widget, just copy
the code to make your own widget and add horizontal scroll to it following
the vertical implementation as a model (and dropping the stuff you probably
don't need, such as all of the parts dealing with focus moving around the
scrollable region).

On Wed, Apr 1, 2009 at 1:00 PM, acrosser <[email protected]> wrote:

>
> Thanks for the suggestion... but ScrollView only scrolls vertically up/
> down, not horizontally left/right. At least that's what my experience
> has been trying the ScrollView widget out, and what I have read about
> ScrollView. Is there a way to make it scroll left/right as well?
>
>
> On Apr 1, 8:53 am, Streets Of Boston <[email protected]> wrote:
> > What about using a ScrollView as your container view?:
> >
> > LinearLayout
> >   |-->ScrollView
> >     |--> SkyView
> >
> > On Apr 1, 11:49 am, acrosser <[email protected]> wrote:
> >
> > > Surely this hasn't stumped the group of brilliant Android
> > > developers! :-) Is there any tutorial or reference page someone can
> > > point me to?
> >
> > > On Mar 31, 9:10 am, acrosser <[email protected]> wrote:
> >
> > > > In the Android API examples there is a Snake game. This game uses a
> > > > class
> > > > called SnakeView, which inherits from TileView.
> >
> > > > I am doing something very similar to this. I am inheriting from
> > > > TileView to create a class (SkyView), which will become a square
> board
> > > > for a board game (similar to the board for Checkers).
> >
> > > > However, I would like for my game board to be 400x400 pixels in size,
> > > > which will be bigger than the screens of some Android devices (such
> as
> > > > the G1). And I would like for the user to be able to freely scroll
> and
> > > > drag the board around with their finger (both horizontal and vertical
> > > > scrolling/dragging).
> >
> > > > Can someone please point me in the correct direction for implementing
> > > > this? The board must be no smaller than 400x400px in size. And
> however
> > > > much of the board that can be displayed at once on the screen, should
> > > > be displayed
> > > > at once.
> >
> > > > Should I wrap my SkyView widget in an AbsoluteLayout and use
> > > > Scrollbars? If so, what Scrollbar properties to I need to use? I
> > > > played around with Scrollbars in both directions but couldn't get it
> > > > to work. Is there another view layout I should put it inside? Code
> > > > examples would be nice! Thanks for the help. I am at a loss with this
> > > > one.- Hide quoted text -
> >
> > > - Show quoted text -
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to