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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:51:34+00:00 2026-06-01T13:51:34+00:00

I am currently trying to learn Android. Have been reading tutorials and manual for

  • 0

I am currently trying to learn Android. Have been reading tutorials and manual for some days now.
I am stuck at a layout issue.

I’m scrapping the content from a webpage and displaying it to the user. That’s the working of my app.

My layout is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:padding="5px">

<TextView
    android:id="@+id/tvOutput"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView" />

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_marginTop="5dp">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TableLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:stretchColumns="0" android:id="@+id/tblOutput">

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow7"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow8"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow9"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow10"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow11"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

        </TableLayout>

        <Button
            android:id="@+id/btnBack"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/lblBack" android:layout_marginTop="10dip"/>


        <Button
            android:id="@+id/btnSendSMS"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:text="@string/lblSendSMS" />

    </LinearLayout>

</ScrollView>

Via code, I’ll loop through the TableRows and add two TextViews each. Below is a sample piece of it:

                for(i=1;i<=11;i++){
                    TextView tv1 = new TextView(getApplicationContext());
                    TextView tv2 = new TextView(getApplicationContext());

                    //get values and store it in strValue1 & strValue2
                    //....

                    tv1.setText(strValue1); //a long text
                    tv2.setText(strValue2); //would always be a 3 letter value
                    //tv1.setEllipsize(TruncateAt.MARQUEE);
                    //tv1.setMarqueeRepeatLimit(1);
                    tv1.setSingleLine(true);
                    tv1.setEllipsize(TruncateAt.END);
                    tv1.setGravity(Gravity.LEFT);


                    tr = (TableRow) findViewById( getResources().getIdentifier("tableRow"+i, "id", getPackageName()));
                    tr.addView(tv1);
                    tr.addView(tv2);
                }

The problem is, setEllipsize() for the first TextView on each TableRow is not doing anything. It just shows the text of first TextView (long text overflowing the width) and the TextView2 is not even displayed.

When I tried the setEllipsize() and setSingleLine() on an existing TextView (the very first TextView in my layout – you could see from the above XML, which is above the Table Layout), it’s working fine.

Any ideas where I went wrong ? Or any suggestions ?

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-01T13:51:36+00:00Added an answer on June 1, 2026 at 1:51 pm

    You need to set a fixed height for the TextView with any one of the ways possible. Setting the number of lines or just setting the height of the TextView layout. If you dont then since ure textview has wrap_content as height, it will resize and show all the text.

    So first fix the size of the textview and then setellipsize()

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

Sidebar

Related Questions

Im currently trying to learn some stuff about encryption, it's algorithms and how it
I am currently trying to learn some more about web design and I used
I am currently trying to learn some more in depth stuff of file formats.
I'm currently trying to learn regular expressions with some simple "real world" examples. Take
I am currently trying to learn J2ME and build a connect four game (some
I have done a lot with Java but I am currently trying to learn
Greetings, I am currently trying to learn some Java programming. To do this I'm
I am currently trying to learn all new features of C#3.0. I have found
I am currently trying to learn C and I have come to a problem
I am currently trying to learn how to use easymock. I have the following

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.