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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:27:41+00:00 2026-06-01T15:27:41+00:00

I have a layout with three elements and its orientation is ‘horizontal’ I want

  • 0

I have a layout with three elements and its orientation is ‘horizontal’

I want to fix the size that each element occupy in my layout.

first element should take 40% of the total space then second element should occupy 5% and third one should occupy remaining 55% space.

My layout look like this:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >


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

    <TextView
        android:id="@+id/outletname"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="40"
        android:text="@string/outlet_name2" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:text=": " />

    <TextView
        android:id="@+id/outletnamevalue"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="55"
        android:text="abcdefttt" />
</LinearLayout>
</LinearLayout>

text in ‘TextView’ will change dynamically , So I want to keep the constant space for elements irrespective of the content in views…

  • 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-06-01T15:27:42+00:00Added an answer on June 1, 2026 at 3:27 pm

    In order to make weight effective, you must also need to set the widths of your TextViews to 0dp.

    android:layout_width="0dp"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

a have three column layout and i want to have three divs inside the
I have a gridview in which there are two elements in each of its
I have an Activity that, for each widget in the layout, I call setOnClickListener()
I have an container element which is sort of a layout container for its
I have a LinearLayout view that already contains several elements. I want to add
I have custom gallery. Gallery represents items that are frame layout. There are one
I have this layout that works correctly, a relative layout with a text view
I have a spark group with layout set to horizontal. The group contains a
I have a basic layout where different components can be selected using a tree
Is there a way to evenly layout radiobuttons including the radiobutton text? I have

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.