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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:28:48+00:00 2026-05-29T11:28:48+00:00

I have a LinearLayout that works great to produce something like: [ fixed image

  • 0

I have a LinearLayout that works great to produce something like:

[ fixed image size ] [ fixed image size ] [ text takes up the space that is left ]

The XML looks similar to:

<?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="wrap_content" >

    <ImageView
        android:id="@+id/image1"
        android:layout_width="50dp"
        android:layout_height="120dp"
        android:layout_gravity="center_vertical" />

    <ImageView
        android:id="@+id/image2"
        android:layout_width="263dp"
        android:layout_height="150dp"
        android:layout_gravity="center_vertical" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_vertical"
        android:gravity="center_vertical"
        android:paddingRight="5dip"
        android:textColor="#ffffffff"
        android:textSize="13sp" />

</LinearLayout>

Now I want to reverse it, have another view that looks like:

[ text takes up space that is left ] [ fixed image size ] [ fixed image size ]

So I naturally did the obvious thing which 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="wrap_content" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_vertical"
        android:gravity="center_vertical"
        android:paddingRight="5dip"
        android:textColor="#ffffffff"
        android:textSize="13sp" />

    <ImageView
        android:id="@+id/image1"
        android:layout_width="50dp"
        android:layout_height="120dp"
        android:layout_gravity="center_vertical" />

    <ImageView
        android:id="@+id/image2"
        android:layout_width="263dp"
        android:layout_height="150dp"
        android:layout_gravity="center_vertical" />

</LinearLayout>

But in this case, the text just goes over the entire width, because width is fill_parent.. but I don’t want it to wrap_content either.

Is there any easy way to do this?

  • 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-05-29T11:28:49+00:00Added an answer on May 29, 2026 at 11:28 am

    Set textview1’s width to 0dp and add a layout_weight element = 1.

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

Sidebar

Related Questions

There is one image on LinearLayout. I have to move that image in any
i have this app that i developed and it works great on the simulator
i have this app that i developed and it works great on the simulator
I have written a small Android project that shows some (image)buttons. It works fine
I've got a ListView that works just great, except for this minor annoyance. I
I have an extended BaseAdapter that has LinearLayout children (an ImageView and a TextView
I have a LinearLayout view that already contains several elements. I want to add
Intro: I have a LinearLayout, which contains two sub LinearLayouts, like so: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have Radio buttons that are created dynamically. LinearLayout linLayRoot = (LinearLayout)dialogView.findViewById(R.id.dialog_layout_root); RadioGroup radGp
I have a LinearLayout with layoutAnimation property that is used for a customize ExpandableListView

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.