2013-01-05 34 views
8

हाल ही में (शायद एक नई एसडीके सुविधा के रूप में), जब मैं Textview से टेक्स्ट खींचने का प्रयास करता हूं, तो मुझे पहले getText() की बजाय विधि getFreezesText() मिलती है।टेक्स्ट व्यू में (एस/जी) etFreezesText क्या है?

मैं इस विधि की परिभाषा को देखा और यह

**android:freezesText** 

If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider. 
Must be a boolean value, either "true" or "false". 
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type. 
This corresponds to the global attribute resource symbol freezesText. 

Related Methods 
setFreezesText(boolean) 

यह मेरे लिए कुछ बताता है कहते हैं।

जब हमें इन तरीकों का उपयोग करना है (यदि कभी भी बिल्कुल)? क्या वे नए हैं या मैंने अभी उन्हें देखा है?

उत्तर

8

आप अपने TextView (या उस बात के लिए EditText आदि) अपने राज्य को बचाने के लिए आप freezesText विशेषता जोड़ना होगा मजबूर करने के लिए करना चाहते हैं:

<TextView 
    ... 
    android:freezesText="true" /> 

प्रलेखन से पर freezesText:

तो सेट , टेक्स्ट व्यू में वर्तमान कर्सर स्थिति जैसे मेटा-डेटा के अलावा इसके जमे हुए आईसीकल के अंदर अपना वर्तमान पूर्ण पाठ शामिल होगा। डिफ़ॉल्ट रूप से यह अक्षम है; यह उपयोगी है जब एक पाठ दृश्य की सामग्री को इस तरह के एक सामग्री प्रदाता

विशेषता और विधि एपीआई 1 के बाद से ही अस्तित्व में है एक लगातार जगह में संग्रहीत नहीं है हो सकता है, तो मैं कहूँगा तुम सिर्फ इसे देखा।

+0

और आउटपुट कैसा दिखता है? क्या यह केवल दृश्यमान पाठ है (यदि पाठ की लंबाई बड़ी है तो टेक्स्टव्यू चौड़ाई)? – sandalone

+0

प्रलेखन 'वर्तमान पूर्ण पाठ' कहता है। हालांकि मैंने इसे व्यक्तिगत रूप से उपयोग नहीं किया है। –