Hi!

I'm trying to use weights on my linear layout to lay things on a fixed
width without relying on measures (px or dp).

Here's my layout:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android";
  android:orientation="horizontal"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@color/translucent_grey">
    <TextView android:text="TextView" android:id="@+id/filter_text"
                  android:layout_width="wrap_content"
android:layout_height="wrap_content"
                  android:paddingLeft="15px" android:layout_weight="4"></
TextView>
    <Spinner android:layout_height="wrap_content" android:id="@+id/
filter_spinner" android:layout_width="wrap_content"
android:layout_weight="3"></Spinner>
    <EditText android:layout_height="wrap_content" android:id="@+id/
editText1" android:layout_width="wrap_content"
android:layout_weight="3">
        <requestFocus></requestFocus>
    </EditText>
    <ImageButton android:layout_height="wrap_content" android:id="@+id/
imageButton1" android:src="@drawable/trash"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical" android:layout_weight="1"></
ImageButton>

</LinearLayout>

So my idea is to have fixed width per component (for the spinner,
text, edit and image). But I found out that this does not work :(

My textview has a dynamic size (depending on the text added) and that
is pushing the other elements to the right.

What I was expecting is to have enough room for the text, and make it
fixed, no matter how many chars it has, the width would be fixed and
aligned.

What do I need to fix for that?

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

Reply via email to