I'm writing the configuration activity for a game that can have a
variable number of players.  Players are listed in the activity and
can be added and removed dynamically.  Users click on players to open
a player-details dialog.

The natural way to display the players list is in a ListView, but the
activity's layout has to be a ScrollView since it's too big to fit on
a screen.  Because of that -- because you can't have one scrolling
element inside another -- I can't use ListView for the list of
players.  But I want the list of players to have all the ListView-like
behaviors that users expect.

Is there an accepted recipe for doing this?

I've tried going in two directions, each of which might work but has a
ways to go still.

First, I tried using a simple LinearLayout, inserting TextViews as
players are added and adding a custom divider view in between them so
the whole thing looks like a ListView.  This lays out correctly,
including dynamically resizing as I add/delete players, but doesn't
behave like a list w.r.t. details like showing focus.

Second, I've tried subclassing ListView with an implementation that
lays itself out tall enough that there's no scrolling.  This shows
focus correctly, but I can't get it to redo the layout when I
add/delete players and, more strangely, OnItemClickListeners aren't
firing.

(I haven't exhausted options for either approach, but neither will be
easy.  And this seems like something that should be easy so I suspect
there's a better approach.)

BTW, the obvious solution to this is to use a ListView with scrolling
diabled -- forced to always lay itself out full-height.  Have I missed
that feature in the documentation?

Thanks,

--Eric

-- 
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