BTW Faber - Did get button to resize according to the text, use
android:layout_width="wrap_content"  and then and explicit padding, ie
android:padding="10sp"

On Jan 10, 5:53 pm, Brad A <hashbro...@gmail.com> wrote:
> Yes, it's frustrating to say the least.  Hard to understand why it
> makes certain UI decisions.  BTW - in your code example you put
> "wrap_contents".  The actual property value is "wrap_content".  Not
> sure if that was just typed in the email or if you have that error in
> your code.
>
> OK - So I got my initial layout problems fixed by using relative
> layouts, but I'm still having problems with getting the TextView to
> wrap properly.
>
> Here is the new layout...
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <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="75sp"
>                 android:layout_height="75sp" android:layout_margin="5sp" />
>         <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                 android:layout_width="wrap_content"
> android:layout_height="fill_parent">
>                 <LinearLayout 
> xmlns:android="http://schemas.android.com/apk/res/
> android"
>                         android:layout_width="wrap_content"
> android:layout_height="fill_parent"
>                         android:layout_centerVertical="true" 
> android:orientation="vertical"
> android:background="@drawable/red">
>                         <TextView android:id="@+id/productName"
>                                 android:layout_width="120sp" 
> android:layout_height="wrap_content"
>                                 android:textSize="16sp" 
> android:textColor="@color/screen_black"
> android:background="@drawable/blue"/>
>                         <TextView android:id="@+id/salesPitch"
> android:layout_width="wrap_content"
>                                 android:layout_height="wrap_content"
>                                 android:layout_marginTop="5sp" 
> android:layout_marginBottom="5sp"
>                                 android:textColor="#80ff0000" 
> android:text="Coming June 2009!"/>
>                 </LinearLayout>
>         </RelativeLayout>
>         <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>                 android:layout_width="wrap_content"
> android:layout_height="fill_parent" android:background="@drawable/
> green"
>                 >
>                 <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_marginRight="5sp"
>                         android:layout_centerVertical="true"
> android:layout_alignParentRight="true" />
>                 <Button android:id="@+id/buy" 
> android:layout_height="wrap_content"
>                         android:layout_width="70sp" android:autoText="true"
>                         android:layout_toLeftOf="@id/favorite"
> android:layout_centerVertical="true" android:background="@drawable/
> yellow"
>                         android:padding="0sp" />
>
>         </RelativeLayout>
> </LinearLayout>
>
> Right now I have to set a fixed with for the TextView.  If I set it to
> wrap_content, then long text will blast through the relative layout on
> the right, so the button and checkbox are not even shown on the
> screen.
> I've played with having the right-side layout set to fill_parent, but
> that ends up taking way more space than it needs and the TextView
> won't even display.
>
> Here's what I need...
> Button and CheckBox on right side get as much space as needed, Image
> on left takes space it needs, Layout in the middle uses the remaining
> space and wraps text as needed.  Doesn't seem like that should be so
> hard.
>
> On Jan 10, 5:04 pm, "Faber Fedor" <faberfe...@gmail.com> wrote:
>
> > On Sat, Jan 10, 2009 at 3:47 PM, Brad A <hashbro...@gmail.com> wrote:
>
> > > Related, when specifying a button, is there a way to just have the
> > > button dynamically size to whatever text is holds?
>
> > In theory 'android:layout_width="wrap_contents"' is supposed to do precisely
> > that, but it's not working for me at the mo'.
>
> > --
>
> > Faber Fedor
> > Cloud Computing New Jerseyhttp://cloudcomputingnj.com
>
>
--~--~---------~--~----~------------~-------~--~----~
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