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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:22:12+00:00 2026-05-20T00:22:12+00:00

Greetings all, I’m trying to create a specific layout that should be very simple

  • 0

Greetings all,

I’m trying to create a specific layout that should be very simple but having a very difficult time and was wondering if I could get some pointers.

The layout I’m looking for looks like this

Text label   Text label   Text Label
spinner      Spinner      Edit Text

The text labels and spinner columns should only take about 40% of the width total, and text label and edit text should take the remaining 60%.

I tried using a table layout, but layout_weight doesn’t seem to have any effect. The only way it seems I can set width is by hard coding the width of the items (android:width). Should I be using a table layout for this or 2 horizontal LinearLayouts? I’m wracking my mind here!

  • 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-20T00:22:12+00:00Added an answer on May 20, 2026 at 12:22 am

    There are a lot of ways to do layouts in Android. You might consider nested LinearLayouts, whose orientation can be vertical or horizontal and you can assign layout_weight attributes to each element inside them. I don’t believe layout_weight is valid outside of a LinearLayout, and so the best you can do in a TableLayout is setting the gravity. If I understand your intention correctly, you might try something like this:

    <!-- this container holds everything -->
    <LinearLayout
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      >
      <!-- holds a text label and spinner -->
      <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        >
        <!-- TextView1 goes here -->
        <!-- Spinner1 goes here -->
      </LinearLayout>
    
      <!-- another one of the same -->
      <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        >
        <!-- TextView2 goes here -->
        <!-- Spinner2 goes here -->
      </LinearLayout>
    
      <!-- last column, with the label and edit text -->
      <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        >
        <!-- TextView3 goes here -->
        <!-- EditText1 goes here -->
      </LinearLayout>
    </LinearLayout>
    

    You can find more information about LinearLayout (and RelativeLayout which is a good alternative for you) from http://developer.android.com/resources/tutorials/views/hello-linearlayout.html. Good luck!

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

Sidebar

Related Questions

Greetings all, I'm trying to localize a .NET/C# project. I'm using string resource files
Greetings All! I am having some troubles on how to execute thousands upon thousands
Greetings all, I have some JSON code that looks like this: { playlist: [
Greetings to all! This is my first question here on stackoverflow. I have a
I am new here so first of all my greetings to you I am
Greetings, I'm trying to find a way to 'unbind' a socket from a particular
Greetings, I'm trying to find either a free .NET library or a command-line executable
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
Greetings, The VBA code below will create an Excel QueryTable object and display it
Greetings all, Is there a built in way to know when a user is

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.