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

  • Home
  • SEARCH
  • 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 7498469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:29:18+00:00 2026-05-29T19:29:18+00:00

I need to create an Android horizontal layout design with a vertical LinearLayout on

  • 0

I need to create an Android horizontal layout design with a vertical LinearLayout on the left and a TextView on the right, as shown below:

¦==========================¦
¦      A1     ¦            ¦
¦             ¦     BB     ¦
¦      A2     ¦            ¦
¦==========================¦

The vertical LinearLayout on the left contains two TextView elements and sections A and B take the entire screen width. All TextView elements contain dynamically assigned text content.

I want the width of the TextView B to be determined by its content so that it expands or shrinks to show its entire content (which can’t wrap and must be shown in a single line), while the width of the LinearLayout A on the left is to be determined by the width of TextView B, as shown below:

TextView B expands:

¦==========================¦
¦     A1    ¦              ¦
¦           ¦     BBB      ¦
¦     A2    ¦              ¦
¦==========================¦

TextView B shrinks:

¦==========================¦
¦      A1       ¦          ¦
¦               ¦    B     ¦
¦      A2       ¦          ¦
¦==========================¦

My idea was to use a LinearLayout like this:

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

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/A1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView
            android:id="@+id/A2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <TextView
        android:id="@+id/B"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:singleLine="true" />

</LinearLayout>

but with the above layout, if the content of TextView A1 is long enough, it takes the whole screen width and TextView B disappears.

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-05-29T19:29:20+00:00Added an answer on May 29, 2026 at 7:29 pm

    You should make the right textview to wrap content and make the left linearlayout use the weight attribute as

    android:layout_weight="1.0"
    

    This will tell the linearlayout to take the remaining space. But if the text is too long, either reduce the size of the text or elipsize.

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

Sidebar

Related Questions

I need to create checkboxes dynamically in android. I am getting the value in
I create an android application. I need the check, how my application is working
what software do I need to create an android app?
I need create menu for widget like this https://www.gstatic.com/android/market/com.bugabuga.switcher/ss-320-0-0 . What components are used?
What's the best way to create android market like layout? I was thinking to
I have a problem I need to create table in database SQLite in Android
I am working on android applications. In my project I need to create Listview.
Hello i am new in developing Android applications, I need to create an application
I want to create a layout in which two bars , one at top
I have the following layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal> <ImageView android:id=@+id/movie_icon android:src=@drawable/star_off android:layout_height=wrap_content

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.