0

This is what is expected to come-----

The first text view:

Fox Pro

Drag

Main View Item

This is what is coming-----

And the other text view:

Fox Pro

Drag

Main View
Item

So if the text is long enough to certain limit, it is coming wrapped in a next line.

Please note that the problem is only coming in the higher ppi 7inch device(~213 ppi).

The same thing is coming fine in lower ppi 7inch device(~160 ppi).

I tried to do the following programatically, setting the width to full match_parent-------

DisplayMetrics dm = new DisplayMetrics();

            // Display device dpi value of Y in pixels
            int screenDPIy = (int)dm.ydpi;

            if(screenDPIy > 180)
            {
                entrytype.setTextSize(14);
                entrydate.setTextSize(12);

                entrytype.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                entrydate.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));

            }
            else
            {
                entrytype.setTextSize(16);
                entrydate.setTextSize(14);
            }

No Success.

My Layout xml:

<?xml version="1.0" encoding="utf-8"?>
<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:id="@+id/mapentrieslist"
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:background="@drawable/selector"
        android:gravity="left|center_vertical"
        android:orientation="horizontal" >


        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginTop="4dp"
            android:layout_weight="0.9"
            android:orientation="horizontal"
            android:padding="5dp" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="0.47"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/entrytype"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Fox Pro"
                    android:textColor="#000000"
                    android:textSize="16sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/vehicle_source"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="" 
                    android:visibility="gone"/>

                <TextView
                    android:id="@+id/entrydate"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=""
                    android:textColor="#989898"
                    android:textSize="14sp" />
            </LinearLayout>
        </LinearLayout>
       </LinearLayout>
      </LinearLayout>
sjain
  • 23,126
  • 28
  • 107
  • 185

1 Answers1

0

You have a number of options:

The first two preserve the text while the third removes the extra characters.

Community
  • 1
  • 1
BC2
  • 892
  • 1
  • 7
  • 23
  • I don't want the scrolling of the textview. I want the textview to come in the same line. It should not wrap to the second line as shown in the example. – sjain Jul 09 '13 at 15:39
  • Does the text have enough room visually to fit on the screen horizontally? – BC2 Jul 09 '13 at 16:31
  • Yes the text have enough room. The fact is - the same code is working on 7inch tablet with a ppi value of ~160 but its not working for 7inch tablets having ppi as higher as ~216. – sjain Jul 09 '13 at 16:36