I have a List and am providing a specific view for each row.  All java
functionality is workign fine, it's the layout of the view elements
that is giving me trouble.  I
This is the layout I'm trying to achieve (how to show in text
message?):
Image -> Text(name)/Text(Price) -> Button - CheckBox

where Image is on the left, next the 2 text fields are stacked on each
other and centered, then the Button and Checkbox are right-justified.

Here is the xml I have right now ...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:layout_width="fill_parent"
android:layout_height="fill_parent"
        android:orientation="horizontal">
        <ImageView android:id="@+id/offerImage" android:layout_width="80sp"
                android:layout_height="80sp" android:layout_margin="5sp" />
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="wrap_content"
android:layout_height="fill_parent"
                android:orientation="vertical"
android:layout_gravity="center_vertical">
                <TextView android:id="@+id/productName" 
android:layout_width="100sp"
                        android:layout_height="wrap_content"
                        android:textSize="14sp" 
android:textColor="@color/screen_black"
                        android:layout_gravity="center_vertical"/>
                <TextView android:id="@+id/price"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
        </LinearLayout>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="fill_parent"
android:layout_height="fill_parent"
                android:layout_gravity="right"
                android:orientation="horizontal"
                >
                <Button android:id="@+id/buy" 
android:layout_height="wrap_content"
                        android:layout_width="80sp" android:autoText="true"
android:text="Preorder"
                        android:layout_gravity="center_vertical|right"
                />
                <CheckBox android:id="@+id/favorite" 
style="?android:attr/starStyle"
                        android:layout_width="wrap_content"
android:layout_height="wrap_content"
                        android:layout_marginLeft="5sp"
android:layout_gravity="center_vertical|right"/>
        </LinearLayout>
</LinearLayout>

The overall layout seems to be working, looking at the Hierarchy
Viewer, the Linear Layouts I use for the TextViews and the Button/
CheckBox are laid out correctly and occupying the correct space.
however, the TextViews in teh first layout are pinned to the upper-
right corner of the layout, they should be centered.
And the button and checkbox are centered fine, but the are pinned to
the left edge of teh layout and I want then pinned to the right edge
instead.

Does anyone know how i can accomplish this?

Related, when specifying a button, is there a way to just have the
button dynamically size to whatever text is holds?

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