On 16 February 2011 05:28, TreKing <[email protected]> wrote:

>
> Try giving your RelativeLayout a weight of 1 ("take up all the space you
> need") and the ScrollView a weight of 0 ("take the space that's left").


Thanks for your reply. I tried that, but it didn't work. I then tried
several other arrangements and finally ended up with something much closer
to what I want. Then I tried deleting the weight specifications - and it
kept on working! What I ended up with was:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
  android:id="@+id/controls"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
  android:id="@+id/comment_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
  android:text="@string/comment_label"/>
<EditText
  android:id="@+id/comment"
  android:layout_alignTop="@id/comment_label"
  android:layout_toRightOf="@id/comment_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"/>
<CheckBox
  android:id="@+id/close"
  android:layout_below="@id/comment"
android:layout_width="wrap_content"
android:layout_height="30sp"
android:layout_centerHorizontal="true"
  android:text="@string/edit_close"/>
</RelativeLayout>
<ScrollView
android:layout_alignParentTop="true"
  android:layout_above="@id/controls"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
  android:id="@+id/comments"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""/>
</ScrollView>
</RelativeLayout>

It isn't *exactly* what I wanted (which was for the "id/comments" TextView
to shrink when there was less text), but it's now as close as makes no
difference. Thanks for your help - the layout is much better now.

-- 
Andrew

-- 
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

Reply via email to