2012-01-05 8 views
16

मैंने देखा कि हम इस तरह के रूप android:ellipsize करने के लिए 4 मानों सेट कर सकते हैं के अर्थ:एंड्रॉयड: Ellipsise, विकल्प

कोई नहीं, शुरू करते हैं, मध्य, अंत और मार्की

क्या अर्थ और प्रभाव है इनमें से प्रत्येक को स्थापित करने के लिए?

+0

http://stackoverflow.com/questions/2160619/android-ellipsize-multiline-textview –

उत्तर

29

पता करने के लिए android:ellipsize कैसे काम करता है enter image description here

मैं का इस्तेमाल किया है एक्सएमएल निम्नलिखित नीचे चित्र देखें

<?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> 
+0

बेहतर समझाया जा सकता है .. तो मार्की और एंड का एक ही प्रभाव है .मैं अपने टेक्स्टव्यू मार्की में उपयोग कर रहा था और यह डिवाइस पर नहीं आ रहा था और बस अंत और उसके आने के साथ परीक्षण करने की कोशिश की। इस व्यवहार पर कोई टिप्पणी। बहुत धन्यवाद – png

+9

आपने 'एंड्रॉइड सेट किया है: maxLines =" 4 "', और टेक्स्ट व्यू में 2 लाइनें हैं। क्यूं कर? – jul

+0

महान पोस्ट thx! –