我想通过动态创建TexInputLayout。我可以使用以下代码块创建TextInputLayout: TextInputLayout til = new TextInputLayout(this);
EditText et = new EditText(this);
til.addView(et);
et.setHint("Enter");
information.addView(til); 信息是我在项目中使用的线性布局的名称。 但是我想要改变我动态创建的TextInputLaout的样式,我想使用@style/Widget.MaterialComponents.Text
我正在尝试测试一个自定义布局,它从设计库扩展了TextInputLayout。当我运行测试时,我会得到错误。
java.lang.IllegalArgumentException:您需要在设计库中使用Theme.AppCompat主题(或后代)。在android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:33) at android.support.design.widget.TextInputLayout.(TextInputLayout.java:192) at android.support
我正在用textInputLayout添加小数,问题是在调用isEmpty ()以显示字段为空时出现错误时,此选项不会出现。
我想这样做
button.setOnClickListener {
val numberOne = textInputLayout.editText?.text.toString().toDouble()
val numberTwo = textInputLayout2.editText?.text.toString().toDouble()
val reult = numberOne + n
我尝试在安卓系统中使用TextInputLayout时遇到错误
我有android支持库版本23。但是仍然会出现错误
我的显示错误的xml文件是
无法实例化以下类:
- android.support.design.widget.TextInputLayout (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
11-25 00:58:30.967: E/AndroidRuntime(27848): Caused by: java.lang.IllegalArgum
我想在editText.setEnables(false)时动态地更改boxBackgroundColor of TextInputLayout。我试过通过res/color/selector_ but _background来完成这个任务,但是它没有工作。另外,TextInputLayout (android.support.design.widget.TextInputLayout)没有像boxBackgroundColor这样的参数;( -它只是在AndroidX库(com.google.android.material.textfield.TextInputLayout)中预置的,我现
当试图在UI的TextInputLayout上显示错误消息时,我会得到以下错误
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.blablabla.appname, PID: 23691
java.lang.NoSuchFieldError: No field error_color_material of type I in class Landroid/support/v7/appcompat/R$color; or its superclasses (declaration of 'android.supp
我想从它的子视图TextInputLayout访问PasswordEditText (我的自定义视图从AppCompatEditText扩展)
val editText = findViewById<PasswordEditText>(R.id.passwordEditText)
val textInputLayout = editText.parent as TextInputLayout
但是上面的代码给出了java.lang.NullPointerException: null cannot be cast to non-null type com.google.androi