2016-09-07 7 views
0

android:maxLines、lineSpacing属性を試しましたが、私のEditTextは常に次の行の一部を表示します。一度に1行表示するにはどうすればよいですか?Multiline Edittextで一度に1行だけを表示します

<EditText 
    android:layout_width="match_parent" 
    android:layout_height="30dp" 
    android:id="@+id/formulaView" 
    android:textColor="#000000" 
    android:textCursorDrawable="@drawable/visible_cursor" 
    android:background="#ffffff" 
    android:layout_marginTop="1dp" 
    android:textSize="18sp" 
    android:maxHeight="30dp" 
    android:gravity="center_vertical" 
    android:layout_marginBottom="1dp" 
    android:paddingStart="10dp" 
    android:paddingEnd="10dp" 
    android:scrollbars="vertical" 
    android:imeOptions="actionNext" 
    android:completionThreshold="1" 
    android:inputType="textMultiLine|textNoSuggestions"/> 

enter image description here

+0

xmlレイアウトコードを表示します。 –

+0

@KNeerajLalはい、追加されました。 – Siva

+0

EditTextの高さをwrap_contentに設定します –

答えて

0

代わりに使用

android:inputType="textMultiLine|textNoSuggestions" 

を使用しないでください。

android:inputType="textNoSuggestions" 

コード:

<EditText 
     android:layout_width="match_parent" 
     android:layout_height="30dp" 
     android:id="@+id/formulaView" 
     android:textColor="#000000" 
     android:background="#ffffff" 
     android:layout_marginTop="1dp" 
     android:textSize="18sp" 
     android:text="=SUM(android,Hello,How,Are,You) GoodMorining" 
     android:maxHeight="30dp" 
     android:gravity="center_vertical" 
     android:layout_marginBottom="1dp" 
     android:paddingStart="10dp" 
     android:paddingEnd="10dp" 
     android:scrollbars="vertical" 
     android:imeOptions="actionNext" 
     android:completionThreshold="1" 
     android:singleLine="true" 
     android:inputType="textNoSuggestions"/> 

これが役に立ちます。

素晴らしい一日を過ごしてください。

関連する問題