我发现android:inputType并添加"textMultiLine""textCapSentences"分别使输入文本成为多行和init上限,但是我们如何才能将两者同时编辑成一个编辑文本呢?
因为当我在单个edittext中放置两个android:inputType时会显示错误。

<EditText
    android:id="@+id/editText3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView4"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/textView4"
    android:layout_marginTop="28dp"
    android:inputType="textCapSentences"
    android:ems="10"
    android:inputType="textMultiLine" />  // cannot add this here


我尝试按照答案,但
多行有效,但init上限在此edittext和写入为

android:inputType="textCapSentences"


:-(

最佳答案

这样使用..

android:inputType="textCapSentences|textMultiLine"


在你的代码中

<EditText
    android:id="@+id/editText3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textView4"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/textView4"
    android:layout_marginTop="28dp"
    android:inputType="textCapSentences|textMultiLine"
    android:ems="10"/>

10-08 09:05
查看更多