The first direction worked out.  All it took was to set the TextView
subclass's background to the built-in background
used by list items.  Makes sense once you know it's a possibility.

   android:background="@android:drawable/list_selector_background"

The file and code to use it are checked into sourceforge if anybody
finds that useful:

http://xwords.svn.sourceforge.net/viewvc/xwords/branches/android_branch/xwords4/android/XWords4/res/layout/list_item.xml?revision=3323&view=markup

Thanks,

--Eric

On Apr 25, 9:14 am, eehouse <eeeeho...@gmail.com> wrote:
> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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

Reply via email to