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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:00:17+00:00 2026-06-07T18:00:17+00:00

In my application i am displaying textvalue one below the other from database which

  • 0

In my application i am displaying textvalue one below the other from database which is integer.What i want is i have to make this integer value to be right aligned.Is it possible to right align the text.

My layout code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:paddingTop="4dip"
     android:paddingBottom="6dip"
     android:layout_width="wrap_content"
     android:layout_height="fill_parent"
     android:orientation="vertical"

     >    
<TableLayout 
        android:id="@+id/tablelayout"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:paddingRight="2dip"
       >

    <TableRow  >
 <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Income">
     </TextView>      
        <TextView             
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Expense" android:layout_marginLeft="-150dp">
     </TextView>                     

    </TableRow>    
        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <View
                android:id="@+id/line1"
                android:layout_width="wrap_content"
                android:layout_height="1dip"
                android:layout_weight="1"
                android:background="#FF909090"
                android:padding="2dip" />
        </TableRow>


    <TableRow android:id="@+id/tablerowhouse"   android:layout_marginTop="30px">
 <TextView  android:id="@+id/text40" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Household:" >
     </TextView>            
        <TextView             
            android:id="@+id/houseinctot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Household:" android:layout_marginLeft="-250dp" >
     </TextView>   

          <TextView  android:id="@+id/text41" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Household:" android:layout_marginLeft="-150dp"  >
     </TextView>            
        <TextView             
            android:id="@+id/houseexptot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Household:" android:layout_marginLeft="-70dp" android:gravity="right"
             >
     </TextView>    

    </TableRow>

        <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <View
                android:id="@+id/line1"
                android:layout_width="wrap_content"
                android:layout_height="1dip"
                android:layout_weight="1"
                android:background="#FF909090"
                android:padding="2dip" />
        </TableRow>


 <TableRow  android:layout_marginTop="30px">
 <TextView  android:id="@+id/text42" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Travel:" android:layout_span="3">
     </TextView>     
      <TextView
           android:id="@+id/trlinctot"
           android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Travel" android:layout_marginLeft="-250dp" android:layout_alignParentRight="true">
     </TextView>     

           <TextView  android:id="@+id/text43" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Travel:" android:layout_marginLeft="-150dp" >
     </TextView>            
        <TextView             
            android:id="@+id/trlexptot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Travel:" android:layout_marginLeft="-70dp"  android:gravity="right"
            >
     </TextView>    
 </TableRow>


     <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <View
                android:id="@+id/line1"
                android:layout_width="wrap_content"
                android:layout_height="1dip"
                android:layout_weight="1"
                android:background="#FF909090"
                android:padding="2dip" />
        </TableRow>


     <TableRow  android:layout_marginTop="30px">
 <TextView  android:id="@+id/text44" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Education:" android:layout_span="4">
     </TextView>     
      <TextView
           android:id="@+id/eduinctot"
           android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Education" android:layout_marginLeft="-250dp" android:layout_alignParentRight="true">
     </TextView>  

           <TextView  android:id="@+id/text45" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Education:" android:layout_marginLeft="-150dp" >
     </TextView>            
        <TextView             
            android:id="@+id/eduexptot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Education:" android:layout_marginLeft="-70dp"  android:gravity="right"
            >
     </TextView>    
 </TableRow>

         <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <View
                android:id="@+id/line1"
                android:layout_width="wrap_content"
                android:layout_height="1dip"
                android:layout_weight="1"
                android:background="#FF909090"
                android:padding="2dip" />
        </TableRow>

        <TableRow  android:layout_marginTop="30px">
 <TextView  android:id="@+id/text46" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Group4:" android:layout_span="4">
     </TextView>     
      <TextView
           android:id="@+id/grp4inctot"
           android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="group4" android:layout_marginLeft="-250dp">
     </TextView>  

           <TextView  android:id="@+id/text47" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Group4:" android:layout_marginLeft="-150dp" >
     </TextView>            
        <TextView             
            android:id="@+id/grp4exptot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="group4:" android:layout_marginLeft="-70dp"  android:gravity="right"
            >
     </TextView>    
 </TableRow> 

            <TableRow
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <View
                android:id="@+id/line1"
                android:layout_width="wrap_content"
                android:layout_height="1dip"
                android:layout_weight="1"
                android:background="#FF909090"
                android:padding="2dip" />
        </TableRow>

             <TableRow  android:layout_marginTop="30px">
 <TextView  android:id="@+id/text48" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Group5:" android:layout_span="4">
     </TextView>     
      <TextView
           android:id="@+id/grp5inctot"
           android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="group5" android:layout_marginLeft="-250dp">
     </TextView>  

           <TextView  android:id="@+id/text49" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Group5:" android:layout_marginLeft="-150dp" >
     </TextView>            
        <TextView             
            android:id="@+id/grp5exptot" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="group5:" android:layout_marginLeft="-70dp"  android:gravity="right"
            >
     </TextView>    
 </TableRow> 

My format of display should like this (I am dispalying 2 column like structure in the layout with space between them):

12233      67999 
    9          8  
   48         56 
 4567        576   

But it is showing like this:

 12233     45345
 9         6  
 48        677
 4567.     3566

If i use gravity:right means:
It is going to right extreme of the screen and overlapping value there.

Please help me.Thanks in advance.

  • 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-07T18:00:18+00:00Added an answer on June 7, 2026 at 6:00 pm

    updated your layout XML to solve the text overlapping issues. find the updated layout XML file here

    • Instead of giving margins to align table columns, use 0dp as value for layout_width parameter and value 1 for layout_weight parameter for your textviews.
    <TableRow>
    
        <TextView
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Income" >
        </TextView>
    
        <TextView
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Expense" >
        </TextView>
    </TableRow>
    
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <View
            android:id="@+id/line1"
            android:layout_width="wrap_content"
            android:layout_height="1dip"
            android:layout_weight="1"
            android:padding="2dip"
            android:background="#FF909090" />
    </TableRow>
    
    <TableRow
        android:id="@+id/tablerowhouse"
        android:layout_marginTop="30px" >
    
        <TextView
            android:id="@+id/text40"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Household:" >
        </TextView>
    
        <TextView
            android:id="@+id/houseinctot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:layout_marginRight="2dp"
            android:text="Household:" >
        </TextView>
    
        <TextView
            android:id="@+id/text41"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Household:" >
        </TextView>
    
        <TextView
            android:id="@+id/houseexptot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="Household:" >
        </TextView>
    </TableRow>
    
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <View
            android:id="@+id/line1"
            android:layout_width="wrap_content"
            android:layout_height="1dip"
            android:layout_weight="1"
            android:padding="2dip"
            android:background="#FF909090" />
    </TableRow>
    
    <TableRow android:layout_marginTop="30px" >
    
        <TextView
            android:id="@+id/text42"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Travel:" >
        </TextView>
    
        <TextView
            android:id="@+id/trlinctot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:layout_marginRight="2dp"
            android:text="Travel" >
        </TextView>
    
        <TextView
            android:id="@+id/text43"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Travel:" >
        </TextView>
    
        <TextView
            android:id="@+id/trlexptot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="Travel:" >
        </TextView>
    </TableRow>
    
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <View
            android:id="@+id/line1"
            android:layout_width="wrap_content"
            android:layout_height="1dip"
            android:layout_weight="1"
            android:background="#FF909090"
            android:padding="2dip" 
            />
    </TableRow>
    
    <TableRow android:layout_marginTop="30px" >
    
        <TextView
            android:id="@+id/text44"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Education:" >
        </TextView>
    
        <TextView
            android:id="@+id/eduinctot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:layout_marginRight="2dp"
            android:text="Education" >
        </TextView>
    
        <TextView
            android:id="@+id/text45"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Education:" >
        </TextView>
    
        <TextView
            android:id="@+id/eduexptot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="Education:" >
        </TextView>
    </TableRow>
    
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <View
            android:id="@+id/line1"
            android:layout_width="wrap_content"
            android:layout_height="1dip"
            android:layout_weight="1"
            android:background="#FF909090"
            android:padding="2dip" />
    </TableRow>
    
    <TableRow android:layout_marginTop="30px" >
    
        <TextView
            android:id="@+id/text46"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Group4:" >
        </TextView>
    
        <TextView
            android:id="@+id/grp4inctot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:layout_marginRight="2dp"
            android:text="group4" >
        </TextView>
    
        <TextView
            android:id="@+id/text47"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
    
            android:text="Group4:" >
        </TextView>
    
        <TextView
            android:id="@+id/grp4exptot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="group4:" >
        </TextView>
    </TableRow>
    
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
    
        <View
            android:id="@+id/line1"
            android:layout_width="wrap_content"
            android:layout_height="1dip"
            android:layout_weight="1"
            android:background="#FF909090"
            android:padding="2dip" />
    </TableRow>
    
    <TableRow android:layout_marginTop="30px" >
    
        <TextView
            android:id="@+id/text48"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Group5:" >
        </TextView>
    
        <TextView
            android:id="@+id/grp5inctot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:layout_marginRight="2dp"
            android:text="group5" >
        </TextView>
    
        <TextView
            android:id="@+id/text49"
           android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
    
            android:text="Group5:" >
        </TextView>
    
        <TextView
            android:id="@+id/grp5exptot"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="right"
            android:text="group5:" >
        </TextView>
    </TableRow>
    

    Note: If you provide a drawing that shows the expected screen layout, experts here may be able to help you.

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

Sidebar

Related Questions

I have with an blue tooth application from android api sample.I am displaying blue
i am developing one application for displaying images and labels and its sound.i want
Currently i am working on a iPhone Application Which is displaying video. I have
In my application I am displaying text from database in a textview. The text
In my android application I am inserting and displaying data from a SQLite database.
In my application i want displaying the one image as half of the screen
I have an application that has a UILabel displaying the current date and time,
I would like to have a view in my OS-X (Lion) application for displaying
in my application I am displaying thumbnails of user album's images.What I want to
in my web application i am displaying videos of user, I want to display

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.