Stacking a ListView with other widgets below?

by Romain Guy » Sat, 14 Nov 2009 07:13:49 GMT


Sponsored Links
 Don't use a ScrollView, it won't work. Add footers to your ListView.



>



Stacking a ListView with other widgets below?

by Mark Wyszomierski » Sat, 14 Nov 2009 07:27:35 GMT


 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





> >


Sponsored Links


Stacking a ListView with other widgets below?

by Romain Guy » Sat, 14 Nov 2009 07:40:46 GMT


 When you add the footer to the listview you need to indicate it can
receive focus: 
 http://d.android.com/reference/android/widget/ListView.html #setItemsCanFocus(boolean)





>> >



Stacking a ListView with other widgets below?

by Mark Wyszomierski » Sat, 14 Nov 2009 07:53:01 GMT


 Romain, thanks, that saved me.






> >> >



Stacking a ListView with other widgets below?

by Mark Wyszomierski » Sun, 15 Nov 2009 02:08:26 GMT


 ne 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:52pm, Mark Wyszomierski <mar...@gmail.com> wrote:
> > >> >



Stacking a ListView with other widgets below?

by Mark Wyszomierski » Sun, 15 Nov 2009 04:03:04 GMT


 his is problem is probably related to this ListView bug:
http://code.google.com/p/android/issues/detail?id=4255#c2

On Nov 14, 1:07pm, Mark Wyszomierski <mar...@gmail.com> wrote:
> > > >> >



Other Threads

1. How to scroll text in chat window

Hi all,

 Currently i am working on chat window for our IM,
I have take idea to implement it from api demo > Text>LogTextBox.

I have added  Edit text field at bottom of the screen and getting
string from edit text and appending to text view.
but when text reaches at the bottom its not start scrolling upwords.
How we can scroll text upwords when it reaches at end any one can help
me regarding this. I am using same code which is in Log text
Box .Thanks in advance.

Regards,
Gulfam Hassan
--~--~---------~--~----~------------~-------~--~----~

2. Spinner Data Trouble

Hi there

I am a teach-yourself-Android beginner, and this is my first post...

I am trying to fill a spinner with a few strings. The layout on its
own runs fine, and the code as I have it runs fine, but the spinner
involved is not showing the data in the String array... Here is the
code:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ArrayList<String> users = new ArrayList<String>();
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
R.layout.main, R.id.SpinAccount, users);

        users.add("Neil");
        users.add("Amy");

        aa.notifyDataSetChanged();

        TextView balA = (TextView)findViewById(R.id.TextBalA);
        balA.setText("1.00");
    }

Where have I gone wrong/what am I missing!

Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~

3. Differentiate emulator instances and real device instances.

4. How to pass a map (hashMap) from javascript to android?

5. Mulittouch in android?

6. Is it possible from Android device to access a local pc?

7. How to Set the Wall Paper Programatically in android?