Android 从XML将InputType设置为TextInputItemText
我正在使用这个com.google.android.material.textfield.TextInputLayout来编辑文本 问题是当我试图从XMl设置这个android:inputType=TextCapSequences时,它不起作用,但当我以编程方式设置它时,它起作用了 那房子有什么问题 代码: 试试这个代码 .java类Android 从XML将InputType设置为TextInputItemText,android,android-edittext,Android,Android Edittext,我正在使用这个com.google.android.material.textfield.TextInputLayout来编辑文本 问题是当我试图从XMl设置这个android:inputType=TextCapSequences时,它不起作用,但当我以编程方式设置它时,它起作用了 那房子有什么问题 代码: 试试这个代码 .java类 password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_P
password.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PASSWORD);
xml文件
android:inputType="textEmailAddress"
您必须直接在编辑文本中应用android:inputType=TextCap语句,如下所示:
<android.support.design.widget.TextInputLayout
android:id="@+id/XXX"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
/>
</android.support.design.widget.TextInputLayout>
此外,您还可以将TextInputText替换为EditText您是否将其设置在,或?请检查我的问题我更新了XML代码OK,我刚刚签入’,因为您在问题正文中只提到了TextInputLayout。你在没有android:textAllCaps=true的情况下试过吗?是的,我在没有android:textAllCaps=true的情况下也试过,但我遇到了同样的问题,他想要大写的句子!!我已经完成了这段代码,正如我所说的,它正在工作,但我想从XML方面来做
<android.support.design.widget.TextInputLayout
android:id="@+id/XXX"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
/>
</android.support.design.widget.TextInputLayout>