2016-09-07 3 views
0

Я пробовал Android: singleLine, maxLines, атрибуты lineSpacing, но мой EditText всегда отображает часть следующей строки. Как я могу заставить его отображать одну строку за раз?Отображать только одну строку за раз, в Multiline Edittext

<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

set EditText height to 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"/> 

Надеюсь, это поможет.

Имейте большой день вперед.

Смежные вопросы