Hi Ram,

You should not be using wrap_content on the ListView but rather
layout_height="0dip".

Thanks,
Megha

On Mon, Mar 31, 2008 at 10:39 AM, Ram <[EMAIL PROTECTED]> wrote:

>
> *bump*
>
> On Mar 30, 1:00 am, Ram <[EMAIL PROTECTED]> wrote:
> > Hi, I'm trying to create a screen with a listview and two buttons on
> > it.
> >
> > I tried the following combination in main.xml and it seemed to work
> > right (with the listview taking up ~80% of the height and the two
> > buttons ~10% each)
> >
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> >     android:orientation="vertical"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > .......
> >     <ListView android:id="@+id/android:list"
> > android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> >         android:layout_weight="0.8" .........
> >
> >     <Button android:id="@+id/test1"          android:text="@string/
> > test1"
> >         android:layout_width="wrap_content"
> > android:layout_height="wrap_content"
> >         android:layout_weight="0.1" ........ and similarly for button2
> > ------------
> > Then, I tried increasing the button weights to 0.3 each and I reduced
> > the listview weight to 0.4.
> >
> > With these changes, my expectation was that the listview would take
> > 40% of the screen height and that the buttons would take 30% each.
> > However, after the changes, the listview took up even more space than
> > before. So I could see more list elements on the first screen now
> > (though the listview weight was now only 40% and it had been 80%
> > earlier)
> >      The two buttons shrunk in height and so the button text wasn't
> > drawn
> >
> > Does anyone know why increasing the layout_weight of the two buttons
> > (from 10% to 30% each) decreased the height of the buttons (and why
> > decreasing the layout_weight of the listview increased its height)
> >
> > Thanks Ram
> >
>

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to