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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:44:30+00:00 2026-05-23T09:44:30+00:00

I am trying to create a layout with three textviews beside each other. The

  • 0

I am trying to create a layout with three textviews beside each other. The textviews are of different length.

All I want to do is to arrange them so that they always have equal layout_width irrespective of the length of their text.

Approaches I tried:

1) I tried using linear_layout and setting the weight of textviews to be 1 but that does not do it since it applies only for the remaining width after all textViews are positioned.

2) I also tried using table layout and stretching all the columns by using stretchColumns=”*”. but that also allocates the required width to the length of the texts and only then does it stretch the columns.

3) This is a hack but this is not working either. I tried to have a linear layout inside a relative layout with three textviews to have no text but force them to be of equal widths by setting their weights. This works but then I want my next views which are in the relative layout to align themselves to the right and left edges of the views within the linear layout. But this does not work. Here is my layout that I used for this.

        <RelativeLayout
            android:layout_width="fill_parent" android:layout_height="fill_parent" >
            <!-- This is a hack to have all three textviews in a row to obtain equal width -->
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
                <TextView android:id="@+id/tv_ref1"
                    android:layout_width="0dp" android:layout_height="wrap_content"
                    android:text="My"
                    android:layout_weight="1.0"
                    android:gravity="center" />
                <TextView android:id="@+id/tv_ref2"
                    android:layout_width="0dp" android:layout_height="wrap_content"
                    android:text="My"
                    android:layout_weight="1.0"
                    android:gravity="center" />
                <TextView android:id="@+id/tv_ref3"
                    android:layout_width="0dp" android:layout_height="wrap_content"
                    android:text="My ghghhfghjjghjkkhgfhfghfjhjh"
                    android:layout_weight="1.0"
                    android:gravity="center" />
            </LinearLayout>


            <TextView
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:layout_below="@id/tv_ref1"
                android:gravity="center"
                android:text="Text Text Text"
                android:textColor="@color/white" />
            <TextView
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:layout_below="@id/tv_ref1"
                android:gravity="center_horizontal"
                android:text="Med"
                android:textColor="@color/white" />
            <TextView
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:layout_below="@id/tv_ref1"
                android:gravity="center"
                android:text="Long Text wtwy yu hjsyi"
                android:textColor="@color/white" />

        </RelativeLayout>

Please let me know what I might be doing wrong or how I can force my textviews in a row to have equal widths.

Thank you.

  • 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-23T09:44:31+00:00Added an answer on May 23, 2026 at 9:44 am

    Setting layout_width to “fill_parent” and layout_weight to “1” for all your TextEdits forces them to have equal width

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

Sidebar

Related Questions

I'm trying to create an app that offers the user 3 different kinds of
I am trying to create a layout that extends to the whole screen if
I am trying create a layout. There are several inner layouts that should like
I'm trying to make a LinearLayout that has three rows, each of equal height.
I am simply trying to create a layout where there are multiple TextViews (and
New to all three. I am trying to create sample grid. Basically I am
Im trying to create a layout in flex using mxml, the layout contains a
I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
I'm trying to create a layout with display: table and alike, but it seems
I am trying to just create a basic layout, but i am having trouble

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.