当android中提供inputType时,最小行不工作
任何人都遇到过这种情况。我需要为edittext显示至少4行,当给定的最小行正常工作时,但当向其添加inputType标记时,最小行失败当android中提供inputType时,最小行不工作,android,android-edittext,Android,Android Edittext,任何人都遇到过这种情况。我需要为edittext显示至少4行,当给定的最小行正常工作时,但当向其添加inputType标记时,最小行失败 <EditText android:id="@+id/my_review_review_text" android:layout_width="match_parent" android:layout_height="wrap_conten
<EditText
android:id="@+id/my_review_review_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:inputType="textCapSentences|textAutoCorrect"
android:background="@drawable/rect"
android:gravity="top|left"
android:hint="Add a review"
android:maxLines="5"
android:minLines="4"
android:padding="10dp" />
如果我错了,请纠正我,并为我提供解决方案……您可以使用
android:inputType=“textcap句子| textMultiLine | textsautocorrect”
此行已被删除
android:inputType = "textCapSentences|textAutoCorrect"
最大线对应于EditText的最大高度,它控制外部边界,而不是内部文本线 如果您想使用有限字符,请使用此
android:maxLength=“20”
试试
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"/>
您可以通过简单地将inputType添加为多行以及其他inputType来实现这一点
<EditText
android:id="@+id/comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine|textNoSuggestions"
android:minLines="6"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="top"
android:padding="5dp"
android:textSize="20sp"
/>
您是否使用过android:inputType=“textcapSequences | textMultiLine | textAutoCorrect”是的…textMultiLine有效。。。你能解释一下为什么失败吗“android:inputType=“textcapSequences | textAutoCorrect”|是一个管道操作符。它包含您提供的所有选项。“TextCapSequences | textMultiLine | textAutoCorrect”表示inPutType的标记TextCapSequences和textMultiLine以及textAutoCorrect处于启用状态。哦……我需要它,通过使用管道操作符为inPutType添加“textMultiLine”,我们可以实现这一点
<EditText
android:id="@+id/comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine|textNoSuggestions"
android:minLines="6"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="top"
android:padding="5dp"
android:textSize="20sp"
/>