Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8539007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:15:35+00:00 2026-06-11T11:15:35+00:00

I am trying to build a speech bubble for a chat room. Each of

  • 0

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!

Correct Behavior in ICS:

Correct Behavior in ICS

Incorrect Behavior in GingerBread:
Incorrect Behavior in GingerBread

XML Layout :

<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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:15:36+00:00Added an answer on June 11, 2026 at 11:15 am

    From the looks of it, this is caused by a circular dependency in your sizes: the inner text and image size is dependent on the FrameLayout (match_parent), while the FrameLayout’s size is dependent on what’s contained inside it (wrap_content). Use of a FrameLayout is discouraged where more than one child is involved for exactly this sort of reason. For safety, I’d recommend changing the FrameLayout to a RelativeLayout, and setting the following property on the inner image view:

    android:layout_alignTop="@+id/message_textview"
    android:layout_alignBottom="@+id/message_textview"
    

    This will ensure your image always matches up to the size of your text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm brand new to this and I'm trying build a simple layout of divs.
Currently I'm working on Text to speech in android and I'm trying to build
Trying to build openssl-fips-2.0 with NDK, before I was lucky found this link and
I am trying build small webcam chat (web application). I searched on google and
Trying to build a plugin effect that will some what look better than this
Im trying to build a little site using XML instead of a database. I
I'm trying build this network connection using BroadcastReceiver. When connection doesnt exist it will
Trying to build a FAQ page using jQuery. This is the js I'm working
Trying to build upon the answers in this thread [ Alphanumeric Counter ] to
I am trying build a jQuery EasyUI datagrid or treegrid out of a large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.