Error android.text.StaticLayout.calculateEllipsis(StaticLayout.java:783)

来源:互联网 发布:睡眠软件哪个好 编辑:程序博客网 时间:2024/05/09 21:42

http://stackoverflow.com/questions/14282757/android-list-view-array-index-out-of-bounds-exception-no-clues 


java.lang.ArrayIndexOutOfBoundsException: length=61; index=-1
at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:783)
at android.text.StaticLayout.out(StaticLayout.java:702)
at android.text.StaticLayout.generate(StaticLayout.java:410)
at android.text.StaticLayout.<init>(StaticLayout.java:140)
at android.widget.TextView.makeSingleLayout(TextView.java:6233)
at android.widget.TextView.makeNewLayout(TextView.java:6079)
at android.widget.TextView.onMeasure(TextView.java:6455)
at android.view.View.measure(View.java:15523)


解决:把middle改成end就ok了

或者 

<TextView    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:ellipsize="middle"    android:maxLines="1"    android:text="blahblahblahblahblahblahblahblahblahbla---go really long" />

But the following does not:

<TextView    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:ellipsize="middle"    android:singleLine="true"    android:text="blahblahblahblahblahblahblahblahblahbla---go really long" />
1 0
原创粉丝点击