views:

2699

answers:

5

Can any one tell me whats going wrong with the text, text exceeds then one line not getting wrap to next line going beyond the screen.

alt text

Following is the code

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:padding="4dip">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:padding="4dip">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:orientation="horizontal" 
            android:padding="4dip">
            <TextView 
                android:id="@+id/reviewItemEntityName"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:text="event/venue" 
                android:textColor="@color/maroon"
                android:singleLine="true" 
                android:ellipsize="end" 
                android:textSize="14sp"
                android:textStyle="bold" 
                android:layout_weight="1" />

            <ImageView 
                android:id="@+id/reviewItemStarRating"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_alignParentBottom="true"
                android:src="@drawable/title_1_star" />
        </LinearLayout>

        <TextView 
            android:id="@+id/reviewItemDescription"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:text="Description comes here" 
            android:textSize="12sp" 
            android:layout_weight="1"/>
    </LinearLayout>
</LinearLayout>
+5  A: 

I fixed it my selves key is android:width="0dip"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" android:layout_height="wrap_content"
 android:padding="4dip">

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content" android:layout_height="wrap_content"
  android:orientation="vertical" android:padding="4dip"
  android:layout_weight="1">

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent" android:layout_height="wrap_content"
   android:orientation="horizontal" android:padding="4dip">
   <TextView android:id="@+id/reviewItemEntityName"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:textColor="@color/maroon" android:singleLine="true"
    android:ellipsize="end" android:textSize="14sp" android:textStyle="bold"
    android:layout_weight="1" />

   <ImageView android:id="@+id/reviewItemStarRating"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentBottom="true" />
  </LinearLayout>

  <TextView android:id="@+id/reviewItemDescription"
   android:layout_width="fill_parent" android:layout_height="wrap_content"
   android:textSize="12sp" android:width="0dip" />
 </LinearLayout>


 <ImageView android:id="@+id/widget01" android:layout_width="wrap_content"
  android:layout_height="wrap_content" android:src="@drawable/arrow_nxt"
  android:layout_gravity="center_vertical" android:paddingRight="5dip" />

</LinearLayout>
Faisal khan
Yeah, this solved the problem for me too... looks like a weird issue.
greg7gkb
better use `android:layout_weight=1` instead of zero-width, it means textview will fill the remaining content
shaman.sir
A: 

you have to use android:singleLine="false" in ur textview tags.

Praveen Chandrasekaran
by default it is false
Faisal khan
A: 

One of your layout parameters is wrong in your code. In the first TextView :android:layout_width="wrap_content"
change to: android:layout_width="fill_parent". The text that out of screen width size will wrap to next line. And set android:singleline="false"

Jeff
A: 

I had the same problem.

In your EditText or TextView use the attribute below and it will solve your problems. Using "wrap_content" only applies to the layout of the view, not the text inside the view:

android:inputType="textMultiLine"

Tallbruva
A: 

I think it depends on the particular combination of layouts in your display. Some flags may get overridden or ignored. I have a TabHost with tabs, each tab is a list of tables. So it is a tab of ListView, each row being a TableLayout of TextView. I tried the fixes listed above and none of them worked.

Anil