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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:52:43+00:00 2026-05-23T02:52:43+00:00

I have 2 textviews side by side, one aligned right and one left to

  • 0

I have 2 textviews side by side, one aligned right and one left to keep them together. The right side is simply a label for the type of measurement given in the left side. The problem is that when the left TextView is a large number, the two TextView’s are side-by-side with no gap in the middle. But as soon as the left TextView becomes a small number, it becomes spaced apart from the right side.

For example, it might look like this during one cycle:
3000meters

And then like this on the next:
5 meters

I need it to keep them together. Is there something I can do to achieve this, xml side or code side when updating the view?

edit – okay I had to edit it in wordpad to get it to show correctly in here

<TableRow android:layout_width="fill_parent"
    android:background="@drawable/maindatabg"> 
            <TableLayout 
                android:layout_gravity="center_horizontal"
                android:stretchColumns="*">
            <TableRow>
               <TextView
                  android:id="@+id/spaceValue"
                  android:text="00.0"
                  android:textStyle="bold"
                  android:textColor="#FFFFFF"
                  android:layout_gravity="right"
                  android:textSize="20dip"/>
              <TextView
                  android:id="@+id/spaceTypeValue"
                  android:layout_height="fill_parent"
                  android:text="meters"
                  android:textStyle="bold"
                  android:textColor="#FFFFFF"
                  android:layout_gravity="left"
                  android:textSize="14dip"/>
          </TableRow>
      </TableLayout>                                                         
</TableRow>
  • 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-23T02:52:44+00:00Added an answer on May 23, 2026 at 2:52 am

    Mention android:gravity=”right” to android:id=”@+id/spaceValue”. A sample layout and tested works fine.

    <?xml version="1.0" encoding="utf-8"?>
    <TableRow xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent" >
    <TableLayout android:layout_gravity="center_horizontal"
        android:stretchColumns="*">
        <TableRow>
            <TextView android:id="@+id/spaceValue" android:text="3000"
                android:textStyle="bold" android:textColor="#FFFFFF"
                android:layout_gravity="right"  android:gravity="right"
                android:textSize="20dip" />
            <TextView android:id="@+id/spaceTypeValue"
                android:layout_height="fill_parent" android:text="meters"
                android:textStyle="bold" android:textColor="#FFFFFF"
                android:layout_gravity="left" android:textSize="14dip" />
        </TableRow>
    </TableLayout>
        </TableRow>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you have two TextViews side by side each with a varying number of
I have a ViewGroup (LinearLayout) which contains a couple of TextViews and one ImageView.
I am creating a layout,I have total 10 textviews placed vertically.On th e left
I have a LinearLayout with some nested LinearLayouts, ImageView's and TextViews. One of the
So it's possible to align the top, bottom, left, and right of one view
Right now I have 2 different UIPickerView in side my UITableViewController. I only show
Ok, my problem is, I have got n-TextViews and they will be added programmatically
I'm trying to get my textview to hug the left side of the screen
I want to have two TextView elements appear side by side (in a list
I have a Custom ListView with an imageview and 2 TextViews above each other

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.