One more question on this - it seems like if we use a header or footer
view - then our activity can not add any other views? Example:
<LinearLayout>
<ListView> // with header and footer views.
</LinearLayout>
the above works perfectly with focus getting routed correctly etc. The
focus acts strangely in this case though:
<LinearLayout>
<LinearLayout>
<Button>
</LinearLayout>
<ListView>
</LinearLayout>
if the list view has focusable items - then the focus jumps back up to
the top LinearLayout-button after hitting down key again. This is kind
of strange, should this be happening? To explain further:
<LinearLayout>
<LinearLayout>
<Button>
</LinearLayout>
<ListView>
// listview is composed of:
TextView
TextView
Button
TextView
</ListView>
</LinearLayout>
so focus is fine up until it hits the row with the Button. The button
gets highlighted (since itemsCanFocus=true), but then hitting the down
arrow key again jumps focus up to the top linear layout button,
instead of continuing focus to the next row of the ListView. Normally
I could just use a header view instead, but is there an undocumented
rule in which we cannot add other views to our layout if using a
ListView with setItemsCanFocus=true?
Thanks
On Nov 13, 6:52 pm, Mark Wyszomierski <[email protected]> wrote:
> Romain, thanks, that saved me.
>
> On Nov 13, 6:34 pm, Romain Guy <[email protected]> wrote:
>
>
>
> > When you add the footer to thelistviewyou need to indicate it can
> > receive
> > focus:http://d.android.com/reference/android/widget/ListView.html#setItemsC...)
>
> > On Fri, Nov 13, 2009 at 3:27 PM, Mark Wyszomierski <[email protected]> wrote:
> > > Hi Romain,
>
> > > If I use a footer view, it can get focus, but its internal controls
> > > cannot be focused using the scroll ball? For example, this is a simple
> > > footer view:
>
> > > LinearLayout llFooter = new LinearLayout(this);
> > > llFooter.setLayoutParams(new AbsListView.LayoutParams
> > > (AbsListView.LayoutParams.FILL_PARENT,
> > > AbsListView.LayoutParams.WRAP_CONTENT));
>
> > > Button btn1 = new Button(this);
> > > btn1.setText("Btn1");
> > > llFooter.addView(btn1);
>
> > > When I use the scroll ball the navigate to the footer, the entire
> > > background gets highlighted, and I cannot access the button on the
> > > layout. Is there some way of doing that for a better user experience,
> > > or do users just have to touch with their finger?
>
> > > Thanks
>
> > > On Nov 13, 6:13 pm, Romain Guy <[email protected]> wrote:
> > >> Don't use a ScrollView, it won't work. Add footers to yourListView.
>
> > >> On Fri, Nov 13, 2009 at 3:11 PM, Mark Wyszomierski <[email protected]>
> > >> wrote:
> > >> > Hi,
>
> > >> > Is there a way to create a layout with aListViewset to use full
> > >> > height, then some additional panels? Something like this:
>
> > >> > <LinearLayout height = "fill_parent">
> > >> > <ScrollView>
> > >> > <ListViewheight = "wrap_content" />
> > >> > <TextView />
> > >> > <TextView />
> > >> > </ScrollView>
> > >> > </LinearLayout>
>
> > >> > Basically I'd like to keep theListViewat a height which contains all
> > >> > its children views, then some static widgets below that - all inside a
> > >> > master ScrollView - is that possible?
>
> > >> > Thanks
>
> > >> > --
> > >> > 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
>
> > >> --
> > >> Romain Guy
> > >> 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
>
> > --
> > Romain Guy
> > 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