Hi Mark,

Thanks for your reply.

Layout is not dependant on the weight, it is a weird combination of
the text size and the weight. If I give a bigger text, the weight
parameter does not have any use. Sorry for my words, I find it Stupid.
But I am very weak in Layouts, I never could understand why it has to
be so complex to do small things :).

I tried giving a weight of 1 to the second text view, but still I can
find that the text size is the determining factor in deciding the
layout. Weight is doing some random role, which I don't understand.
You will understand if you try this in eclipse and see the layout.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
       android:layout_width="fill_parent"
android:layout_height="fill_parent"
       xmlns:android="http://schemas.android.com/apk/res/android";
       android:orientation="horizontal">


       <TextView android:id="@+id/Text1"
               xmlns:android="http://schemas.android.com/apk/res/android";
               android:layout_height="wrap_content"
android:text="first text whichis also big"
               android:layout_weight="2" android:layout_width="wrap_content" />

       <TextView android:id="@+id/Text2"
               xmlns:android="http://schemas.android.com/apk/res/android";
               android:layout_height="wrap_content"
android:layout_width="wrap_content"
               android:layout_weight="1"
               android:text=" Veeeeeeery Loooooooong Text that fills
up alll space" />


       </LinearLayout>


Regarsd
Siju Mathew



2009/10/4 Mark Murphy <mmur...@commonsware.com>:
>
>> LinearLayout obeys weight and as per documentation weight gives
>> priority to an object. Here is the layout I have:
>>
>> Here you can see that the first textview has a weight of 2, second has
>> a weight of 0, but still the second text view takes up all the space.
>> If I give the first edit view a weight of 0 and second a weight of 2,
>> surprisingly, first edit view gets more space. Isn't this weird, or am
>> I doing something very wrong. I am poor in layouts.
>
> Try using a weight of 1, or not having a weight, rather than a weight of 0.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com
> Android App Developer Books: http://commonsware.com/books.html
>
>
>
> >
>

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

Reply via email to