Hi,

I am trying to build a speech bubble for a chat room. Each of the speech 
bubbles has the attached xml layout. 

I am achieving this by setting the *textView* to *wrap_content*, the speech 
bubble *imageView* to *match_parent* and the *frame_layout* to *wrap_content
*. So that the speech_bubble image behind the text *scales according to the 
amount of text* in the bubble. 

I set the width on the textView to match parent and the height to 
wrap_content and for some reason, it *works perfectly* as required in* Ice 
Cream Sandwich *(Android 4.1).
However in *Gingerbread* the inner imageView speech bubble *does not scale 
to match_parent* so that the text can fit neatly inside the bubble. 
In Gingerbread the inner imageView* stays the same size always*, regardless 
of the text and the *text overflows outside the bubble*. 
Even though the *frameLayout* expands to *wrap_content*, the *imageView*does 
not 
*match_parent* as it is supposed to. 

Any ideas on why this is happening?  Is there another parameter I can set 
thru xml or a method I can call programmatically to fix this? 

Thanks,
Bala



<merge xmlns:android="http://schemas.android.com/apk/res/android";>
       <FrameLayout
            xmlns:android="http://schemas.android.com/apk/res/android";
            android:id="@+id/speech_bubble_framelayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="@color/color_transparent"
            android:layout_toRightOf="@id/message_user_imageView">

        <ImageView 
xmlns:android="http://schemas.android.com/apk/res/android";
                   android:id="@+id/message_background_imageview"
                   android:layout_width="match_parent"
                   android:layout_height="match_parent"
                   android:layout_margin="5dp"
                   android:scaleType="fitXY"
                   android:layout_centerInParent="true"
                   android:textColor="@color/color_brown_mud"
                   android:background="@drawable/chat_bubble_flipped"
                />
        <TextView
                android:id="@+id/message_textView"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:maxEms="10"
                android:background="@color/color_transparent"
                android:textColor="@color/color_brown_uiDesign_pallete"
                android:textSize="15sp"
                android:textStyle="bold"
                android:gravity="center_horizontal"
                android:text="Message"
                android:padding="5dp"
                android:layout_marginLeft="25dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="15dp"
                />
    </FrameLayout>
</merge>

-- 
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

<<attachment: ICS Behaviour.png>>

Reply via email to