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. 安卓的Widget
- 2. ImageView的安卓
- 3. 安卓:RelativeLayout的
- 4. 安卓的AsyncTask
- 5. 安卓的flexbox
- 6. ClassNotFoundException的安卓
- 7. 安卓
- 8. 安卓:
- 9. 安卓:
- 10. 安卓:
- 11. 安卓:
- 12. 。安卓
- 13. 安卓:
- 14. 安卓android安卓通過ble通信
- 15. 安卓菜單vs安卓標籤欄
- 16. 安卓的RelativeLayout的
- 17. 安卓:對sqlite的
- 18. 安卓:NoClassDefFoundError的android.os.AsyncTask
- 19. 安卓的繪製
- 20. 安卓:對的libstdC++
- 21. 安卓:從的AsyncTask
- 22. Kivy opencv的安卓
- 23. 安卓上的ePub
- 24. 安卓:空的PendingIntent
- 25. 安卓:在proguard的
- 26. 安卓:在的LinearLayout
- 27. 安卓:java.lang.NoSuchFieldError的:android.os.Build.SERIAL
- 28. 安卓:在imageview的
- 29. 安卓:從SQLite的
- 30. 安卓:在MapView的
http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview – 2012-01-05 09:00:40