Monday, February 14, 2011

[android-developers] TextView length limit? How strange!

Hi, everyone.
I having a ListView,  which has three TextView components in every item. One TextView possiblily display too long text, for example 5000 characters in Ascii code. The testing result is:
G7 ,2.2 , it is ok. But when it running in G3, it just display space, no at all one character. So I just try and trial, when
words.setText(ss.subSequence(0, 3653));
it display all.
when
words.setText(ss.subSequence(0, 3654));
it display none.

The listview item layout is like:

<?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="wrap_content"
    android:orientation="vertical" >
   
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@drawable/friendlist_friend_selector" >   
           
        <TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:id="@+id/chat_item_words"
            android:focusable="false"
            android:text="aaaaa"
            #####################################android:maxLength="3653"
            android:textColor="@android:color/black"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp" />
           
        <TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:id="@+id/chat_item_name"
            android:text="ALIDA:"
            android:focusable="false"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp" />
           
        <TextView
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:id="@+id/chat_item_date"
            android:focusable="false"
            android:text="08-18 22:03"
            android:textSize="14sp"
            android:textColor="@color/message_date"
            android:layout_below="@+id/chat_item_words"
            android:layout_alignParentRight="true"           
            android:layout_marginRight="10dp"
            android:layout_marginTop="4dp" />
           
    </RelativeLayout>
   
   
       
    <View
        android:layout_height="1dp"
        android:layout_width="wrap_content"
        android:background="@color/friendlist_friend_line" />
       
</LinearLayout>

So android:maxLength="3653",  it just works.
I would appreciated if having some hints, thanks a lot.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment