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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:40:47+00:00 2026-05-27T05:40:47+00:00

Not sure it is clear from this question title what I mean, so here

  • 0

Not sure it is clear from this question title what I mean, so here are details.

What I’d like to achive is simple layout with two TextView controls aligned horizontally one after another. First TextView could probably contain several lines of text, second TextView will contain only 1 number.

Second TextView should always have widht as much as it is required to show its content, aligned to the right and height should be equal to height of first TextView so I can show data vertically centered. First TextView should take remaining space (for width) and stretch vertically as needed.

Example 1:

  ---------------------------------
  |Small Text.                 123|
  ---------------------------------

Example 2:

  ---------------------------------
  |Long Text starts here ....     |
  |... continues here .......  123|
  |... and finishes here ....     |
  ---------------------------------

LinearLayout with horizontal orientation is not good here since it places controls from left to right. While in this case I need first set wrap_content to second TextView and then fill_parent to first TextView.

Playing with RelativeLayout I also could not get described layout.

I could not use layout_weight approach here since I do not know length of data in second TextView: in one case it could be 1 character, in another – 8 characters. So in 1 character case I will have unused space.

So, do I have chance to build such layout?

  • 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-27T05:40:47+00:00Added an answer on May 27, 2026 at 5:40 am

    A layout like the following should do the trick for you:

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:singleLine="false"
            android:text="TextView" />
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:gravity="center_vertical|right"
            android:text="TextView" />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not sure how clear my question is by the title, but I
I'm not sure if the title is very clear, but basically what I have
Not sure what exactly is going on here, but seems like in .NET 1.1
Not sure if the title is quite right for the question but I can't
I had trouble coming up with a title for this question because I'm not
Not sure where to post this question, but I am concerned about the security
I'm embarrassed to even ask this question, but not sure of the syntax or
So I'm not sure how stackoverflow friendly this question is since it doesn't have
I'm not sure if this question has been asked before ( searched through SOF
This is as much a design as a technical question. I'm not sure I

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.