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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:49:50+00:00 2026-06-05T19:49:50+00:00

I want to display three different values allocated to two different headers, in other

  • 0

I want to display three different values allocated to two different headers, in other words a first header with one value and a second one with two values

My approach is to split the “header linear layout” 40/60 and the “values linear layout” 40/30/30. In order to not display the text beginning at the border, I put everywhere an android:layout_marginLeft="15dp" in, so finally it should remain proportional.

In my XML, I declare the following:

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView 
        android:layout_weight="4"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:text="@string/txt_price_chf"
        />
    <TextView 
        android:layout_weight="6"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:text="@string/txt_price_offshore_chf"
        />
</LinearLayout>

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView android:id="@+id/tv_price_ch"
        android:layout_weight="4"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:text="Value1"
        />

    <TextView android:id="@+id/tv_price_off_chf"
        android:layout_weight="3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:text="Value2"
        />

    <TextView android:id="@+id/tv_price_off_eur"
        android:layout_weight="3"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="15dp"
        android:text="Value3"
        />
</LinearLayout>

The result is following output:

enter image description here

Why are the “Price offshore:”-TextView and the “Value2”-TextView not in line? Note that “Price offshore” is saved in my strings.xml, there is no error like a whitespace or something. First I thought, it’s caused by the android:layout_marginLeft="15dp", but

  • how I understood it the “dp” is a relative value to a specific
    resolution (so the split-off by android:layout_weigth should not
    effect this) and

  • if I remove the margins, they are still not in
    line.

Has anyone an idea? Do I overlook something obvious?

  • 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-05T19:49:52+00:00Added an answer on June 5, 2026 at 7:49 pm
    <TextView 
            android:layout_weight="4"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="-10dp"
            android:text="@string/txt_price_chf"
            />
    

    This will work for you…

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

Sidebar

Related Questions

Suppose you have a JTable and for each cell you want to display three
if i remove a.three display block this shows up fine. However what i want
I want to combine three sprites and display it as a single sprite. I
I want to do a ranking grid. I have a table with different values
I want to display a message in my homepage (default.aspx), which is different for
I have several TextBoxes, which display angular values. I format these using different custom
I have three dataframes with this structure (but different values): V1 V2 2010-04-30 30
I have a string with two different delimiters (| and ~). I want to
I have built a layout that can display a picture on three different areas.
I want to display a file tree similarly to java2s.com 'Create a lazy file

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.