Android 以编程方式编辑文本属性-文本赢得';t包装
我有以下编辑文本按预期工作Android 以编程方式编辑文本属性-文本赢得';t包装,android,Android,我有以下编辑文本按预期工作 <EditText android:id="@+id/etMensagem" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/hint_message"
<EditText
android:id="@+id/etMensagem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_message"
android:minLines="4"
android:text="@string/send"
android:inputType="textCapSentences|textMultiLine"/>
但当我这样做时,文本不会换行。尽管它是多行EditText,但与XML版本不同,它将文本保持在一行上
我错过了什么?我想你必须这样做
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="none"
android:singleLine="false"
我想你必须这么做
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="none"
android:singleLine="false"
在这里找到了答案:
要以编程方式设置EditText的输入类型,必须
指定输入类类型为文本
最终解决方案:
etMensagem.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
在这里找到了答案:
要以编程方式设置EditText的输入类型,必须
指定输入类类型为文本
最终解决方案:
etMensagem.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
你用过这个android:ScrollHorizontal=“false”你用过这个android:ScrollHorizontal=“false”我没有工作。此外,我需要以编程方式设置它们(问题更新),无论如何,谢谢。我没有工作。此外,我需要以编程方式设置它们(问题已更新),无论如何,谢谢。