Hi,
First caveat before I describe this, is that it must work with Android 2.3.
I am generating the user interface on the fly for a messenger app. The
way it currently works is that there is a vertical linear layout into
which I Factory.Inflate the container the message will go into. I fill
the container and add it to the layout. This works fine and is nice and
easy.
The problem is that the UI container is set like this. One horizontal
layout (weightsum = 1) then two verticals (layout_weights 0.8 and 0.2).
Inside these layouts are two horizontal layouts for text to go into. The
verticals are set to match_parent for the width.
viz
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="fill_parent"
p1:layout_height="fill_parent"
p1:id="@+id/linearLayout1">
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/linearLayout2"
p1:layout_weight="1">
<LinearLayout
p1:orientation="vertical"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="fill_parent"
p1:id="@+id/linearLayout3"
p1:layout_weight=".8">
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/linearLayout5">
<TextView
p1:textAppearance="?android:attr/textAppearanceLarge"
p1:layout_width="wrap_content"
p1:layout_height="fill_parent"
p1:id="@+id/textFrom"
p1:layout_marginLeft="5dp"
p1:layout_marginRight="5dp"
p1:textColor="#000" />
</LinearLayout>
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="fill_parent"
p1:layout_height="wrap_content"
p1:id="@+id/linearLayout6">
<TextView
p1:textAppearance="?android:attr/textAppearanceMedium"
p1:layout_width="wrap_content"
p1:layout_height="fill_parent"
p1:id="@+id/textMessage"
p1:layout_marginLeft="5dp"
p1:layout_marginRight="5dp"
p1:textColor="#000" />
</LinearLayout>
</LinearLayout>
<LinearLayout
p1:orientation="vertical"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="fill_parent"
p1:id="@+id/linearLayout4"
p1:layout_weight=".2">
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:id="@+id/linearLayout7"
p1:layout_width="wrap_content"
p1:layout_height="wrap_content">
<TextView
p1:textAppearance="?android:attr/textAppearanceSmall"
p1:layout_width="wrap_content"
p1:layout_height="fill_parent"
p1:id="@+id/textDate"
p1:gravity="top"
p1:textColor="#000" />
</LinearLayout>
<LinearLayout
p1:orientation="horizontal"
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="wrap_content"
p1:layout_height="wrap_content"
p1:id="@+id/linearLayout8">
<TextView
p1:textAppearance="?android:attr/textAppearanceSmall"
p1:layout_width="wrap_content"
p1:layout_height="fill_parent"
p1:id="@+id/textTime"
p1:gravity="top"
p1:textColor="#000" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
When I inflate and propogate this UI, if the text is too short, the
right hand vertical layout comes over to the left.
What I'm thinking of doing is this. I still have the linearlayout as
before, but instead of loading and inflating, I create a table layout,
propogate that with the data, save and then read that in and inflate.
Can this be done? Thinking of sending it to the ContentDirectory to make
life simpler. Not sure how this would impact on application performance
and speed though.
Thanks
Paul
--
"Space," it says, "is big. Really big. You just won't believe how
vastly, hugely, mindbogglingly big it is. I mean, you may think it's a
long way down the road to the chemist's, but that's just peanuts to
space, listen..."
Hitch Hikers Guide to the Galaxy, a truly remarkable book!
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid