2011-10-03 6 views
7

मैं एक संपादन टेक्स्ट दृश्य देखना चाहता हूं जो पांच लाइनें ऊंची है। मैं चाहता हूं कि यह दृश्य अपील कारणों के लिए केवल पांच लाइनें ऊंची हो (ताकि यह क्रैम्प नहीं दिखाई दे)। नीचे दिया गया कोड काम नहीं करता है, एडिटटेक्स्ट केवल एक पंक्ति उच्च दिखाई देता है।एंड्रॉइड का उपयोग किए बिना मैं अपनी एडिटटेक्स्ट पांच लाइनों को उच्च कैसे बना सकता हूं: inputType = "textMultiLine"?

मैं multilinetext की कोशिश की है और यह नेत्रहीन काम करता है, लेकिन मैं इसे छोड़ देना जैसा कि मैंने वर्चुअल कीबोर्ड चाहते कहने के लिए "अगला" (बजाय कि स्वचालित रूप से बहु पाठ के साथ प्रदान की जाती है में प्रवेश कुंजी है)

कैसे करना चाहते हैं क्या मैं अपना एडिटटेक्स्ट बॉक्स बड़ा कर सकता हूं? वैकल्पिक रूप से, मैं multiline टेक्स्ट के साथ imeOption "actionNext" का उपयोग कैसे कर सकता हूं?

इस कोड काम नहीं करता ...

<EditText 
     android:id="@+id/etEdit" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="top" 
     android:inputType="text" 
     android:lines="5" //this has no effect! 
     android:imeOptions="actionNext" 
     style="@style/dialogInput" /> 
+0

आप विशिष्ट पिक्सेल ऊंचाई को layout_height सेट करने का प्रयास किया था के रूप में अधिकतम पंक्तियां स्थापित करने के लिए EditText की android:minLines और android:maxLines विशेषता का उपयोग कर सकते हैं? पूर्व) 50 डीपी – kingori

उत्तर

3
<EditText 
     android:id="@+id/etEdit" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="top" 
     android:inputType="text" 
     android:lines="5" //this has no effect! 
     android:imeOptions="actionNext" 
     style="@style/dialogInput" 
     android:singleLine="false" /> 

android:singleLine="false" will make editText to support multiple lines 
+1

यह भी काम नहीं करता है। क्या आपने परीक्षण किया है ?? –

+0

मैंने इसका परीक्षण किया और यह काम नहीं करता है। इसके परिणामस्वरूप अगले बटन के साथ एक पंक्ति होती है। अगले बटन के साथ एक multiline नहीं। – tree

1

दूसरी ओर, आप प्रदर्शित करने के लिए पाठ स्ट्रिंग पर एक पंक्ति ब्रेक इस्तेमाल करने की कोशिश कर सकते हैं, इस टिप है : http://xjaphx.wordpress.com/2011/07/15/set-line-break-in-textview/

और निश्चित रूप से, आप सेट करना होगा:

android:singleLine="false" 
,210
0

बदलें:

android:inputType="text" 

करने के लिए:

android:inputType="textImeMultiLine" 

यदि वह काम नहीं करता है तो बदलने के लिए:

android:inputType="text" 

करने के लिए:

android:inputType="textMultiLine" 

और हटाएँ:

android:imeOptions="actionNext" 
style="@style/dialogInput" 
6

बदलें:

android:inputType="text" 

रहे हैं: मेरे लिए

android:inputType="textMultiLine" 

निर्माण!

0

तुम भी इनपुट

 <EditText 
     android:id="@+id/edtChat" 
     style="@style/Widget.AppCompat.EditText" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:minLines="1" 
     android:maxLines="3" 
     android:textSize="16sp" /> 
संबंधित मुद्दे

 संबंधित मुद्दे