सेट करने के बाद सामग्री चौड़ाई को लपेट नहीं सका। मैं पाठ सेट करने पर एनीमेशन को फीका करने के लिए टेक्स्टस्विचर का उपयोग कर रहा हूं। लेकिन जब टेक्स्ट बदल जाता है तो सामग्री को इसकी चौड़ाई से लपेटने में कुछ समस्याएं होती हैं।एंड्रॉइड टेक्स्टस्विचर सेट टेक्स्ट
के बाद मेरी TextSwitched एक्सएमएल है:
<TextSwitcher
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#ffffff"
android:paddingBottom="1dp"
android:paddingLeft="7dp"
android:paddingRight="10dp"
android:paddingTop="1dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@android:color/white" />
</TextSwitcher>
मैं तार की सूची है और कभी मैं लंबे समय से शब्द उदा में बदलाव होने पर "हैलो वर्ल्ड" से "वर्ल्ड" तक, टेक्स्ट्सविचर स्ट्रिंग "वर्ल्ड" के लिए चौड़ाई को लपेटता नहीं है, बल्कि यह "हैलो वर्ल्ड" के शब्द की चौड़ाई रखता है।
संक्षेप में, चौड़ाई सबसे लंबे शब्द की अधिकतम चौड़ाई के लिए तय की जाती है।
कृपया सुझाव दें !!!
Awsome .. धन्यवाद आदमी .... – Debopam
जोड़े एंड्रॉयड के लिए
android:measureAllChildren="false"
जोड़ने का प्रयास करें। यह अपूर्ण है (टेक्स्ट बदलने के बाद केवल चौड़ाई को छोटा करता है, लेकिन बड़े टेक्स्ट में संक्रमण से पहले चौड़ाई बढ़ाता है) लेकिन इसे ज्यादातर काम मिल जाता है। इसे आज़माएं, आप देखेंगे कि मेरा क्या मतलब है। –धन्यवाद !!! उत्तम – Manza