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 7982469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:41:18+00:00 2026-06-04T10:41:18+00:00

I have two LinearLayout One contains a EditText with a patch9 image as a

  • 0

I have two LinearLayout

One contains a EditText with a patch9 image as a speech bubble and another with a TextView and ImageView

When I try typing into the EditText is begins to expand towards the right hand side then starts to reduce the width of the second LinearLayout (crushing the image)

XML is

<?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:background="@color/white"
android:gravity="center"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="left"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/summaryMessage"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/greeting_bubble_white"
            android:gravity="center" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="right"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/summaryImage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/picture_frame" />

        <TextView
            android:id="@+id/summaryText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:paddingLeft="10dp" />
    </LinearLayout>
</LinearLayout>

</LinearLayout>

Looks like this

enter image description here

Any ideas?

  • 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-04T10:41:20+00:00Added an answer on June 4, 2026 at 10:41 am

    its expanding since you have specified that layout_width of your LinearLayout should be “wrap_content“, you should specify a fixed dimension with dps so it doesn’t expand beyond.
    Alternative use the weight tag

    try out this modification:

    <?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:background="@color/white"
    android:gravity="center"
    android:orientation="vertical" >
    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="horizontal"
    android:layout_weight="0.7">
    
         <EditText
            android:id="@+id/summaryMessage"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/greeting_bubble_white"
            android:gravity="center" />
    </LinearLayout>
    
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.3"
        android:gravity="right"
        android:orientation="vertical" >
    
        <ImageView
            android:id="@+id/summaryImage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/picture_frame" />
    
        <TextView
            android:id="@+id/summaryText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:paddingLeft="10dp" />
    </LinearLayout>
    

    however I would suggest more that you use this one:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:gravity="center"
    android:orientation="horizontal" >
    
             <EditText
                android:id="@+id/summaryMessage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="0.7"
                android:background="@drawable/greeting_bubble_white"
                android:gravity="center" />
    
            <TextView
                android:id="@+id/summaryText"
                android:layout_weight="0.3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingLeft="10dp" />
    </LinearLayout>
    

    and that you use compound drawables on your summaryText here is a link that should help you: Using Compund Drawables

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

Sidebar

Related Questions

I have two ImageView s, one TextView and one Gallery in my app and
I have a vertical LinearLayout with two TextView inside it. The former contains a
In my application screen, i have two buttons. one is Activate and another is
I have a layout containing two textViews and one ImageView. the first text is
here in above screen, i have two linear layouts, one for two TextView and
I have two LinearLayout s in my Android application. One (the top) holds a
I have a header for a list that contains two image buttons. I want
i have one List in which their are two textview and one EditView in
Let's say in a LinearLayout we have two EditText. Android system is somehow able
I'm trying to have a TextView that has two pieces of text, one aligned

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.