16
A
回答
29
見下面的圖片就知道如何android:ellipsize
工作
我用下面的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" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:ellipsize="none"
android:singleLine="false"
android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really really long so it gets cut off at the fourth line not joke. Just do it!"
android:layout_marginBottom="25dip"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:ellipsize="start"
android:singleLine="false"
android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really really long so it gets cut off at the fourth line not joke. Just do it!"
android:layout_marginBottom="25dip"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:ellipsize="middle"
android:singleLine="false"
android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really really long so it gets cut off at the fourth line not joke. Just do it!"
android:layout_marginBottom="25dip"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:ellipsize="end"
android:singleLine="false"
android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really really long so it gets cut off at the fourth line not joke. Just do it!"
android:layout_marginBottom="25dip"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:ellipsize="marquee"
android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really really long so it gets cut off at the fourth line not joke. Just do it!" />
</LinearLayout>
相關問題
- 1. ClassNotFoundException的安卓
- 2. ImageView的安卓
- 3. 安卓的Widget
- 4. 安卓:
- 5. 安卓:在proguard的
- 6. 安卓:在MapView的
- 7. 安卓:多TextView的
- 8. 安卓上的ePub
- 9. 安卓:空的PendingIntent
- 10. Kivy opencv的安卓
- 11. 安卓:NoClassDefFoundError的android.os.AsyncTask
- 12. 安卓:從的AsyncTask
- 13. 安卓:java.lang.NoSuchFieldError的:android.os.Build.SERIAL
- 14. 安卓的繪製
- 15. 安卓:對的libstdC++
- 16. 安卓:在的ActivityGroup
- 17. 安卓:setRequestedOrientation
- 18. 安卓:從URL
- 19. 安卓與BeagleBoard
- 20. 安卓預期
- 21. 拉安卓
- 22. 安卓INSTALL_FAILED_MISSING_SHARED_LIBRARY
- 23. 安卓org.apache.http.httpclient包
- 24. 安卓tabHost
- 25. 問題+安卓
- 26. 安卓doInBackground
- 27. 安卓Traceviewer
- 28. 安卓:錯誤
- 29. java.lang.NoClassDefFoundError:在安卓
- 30. 安卓:像iphone
http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview – 2012-01-05 09:00:40