Thursday, March 18, 2010

[android-developers] Re: How to show a ScrollView with button anchored to bottom of screen?

Curiously, no. Shorter code below:

mScrollView = new ScrollView(this);
mListView = new LinearLayout(this);
mScrollView.addView(mListView);
mListView.setOrientation(LinearLayout.VERTICAL);

Button button = new Button(this);
button.setText("OK");

LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(mScrollView);
layout.addView(button);

As the list view grows, the button will disappear outside the screen
and become unreachable. I was very surprised. ;)


On Mar 19, 3:40 am, TreKing <treking...@gmail.com> wrote:
> On Thu, Mar 18, 2010 at 9:40 AM, I.E. <inib...@gmail.com> wrote:
> > So how do I make the ScrollView show a scrolling list, with the bottom
> > button in view, and without specifying an exact size of the
> > ScrollView?
>
> I didn't look at the code, too much to read through, sorry. But if you
> specify the weight on the ScrollView to 1 and add the button(s) in a linear
> layout OUTSIDE and AFTER the ScrollView, the Scroll View will expand to fit
> all of the space leftover after the buttons are positioned within the view.
>
> -------------------------------------------------------------------------------------------------
> TreKing - Chicago transit tracking app for Android-powered deviceshttp://sites.google.com/site/rezmobileapps/treking

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments:

Post a Comment