草庐IT

editText

全部标签

android - 如何在 EditText 上添加图像

我想在EditText中动态添加图像。可能吗?如果有人知道,请提供示例代码。 最佳答案 如果是这样的:就是你所说的,那么你只需要设置Drawable{Right|左|顶部|xml中的bottom}属性,或者调用对应的java命令。EditTexttext=(EditText)findViewById(R.id.text);text.setCompoundDrawables(null,null,getResources().getDrawable(R.drawable.check_box),null);

android - 如何在 EditText 上添加图像

我想在EditText中动态添加图像。可能吗?如果有人知道,请提供示例代码。 最佳答案 如果是这样的:就是你所说的,那么你只需要设置Drawable{Right|左|顶部|xml中的bottom}属性,或者调用对应的java命令。EditTexttext=(EditText)findViewById(R.id.text);text.setCompoundDrawables(null,null,getResources().getDrawable(R.drawable.check_box),null);

Android EditText 用于 android :hint 的密码

刚刚注意到android:password已被弃用,我们应该使用android:inputType。通过在我的xml中设置来试验它android:inputType="textPassword"确实是这样的android:password="true"对于EditText,但似乎如果我使用android:inputType,android:hint将不起作用。EditText将为空白。使用android:password和android:hint时没有这样的问题。我在这里遗漏了一些关于android:inputType的内容吗? 最佳答案

Android EditText 用于 android :hint 的密码

刚刚注意到android:password已被弃用,我们应该使用android:inputType。通过在我的xml中设置来试验它android:inputType="textPassword"确实是这样的android:password="true"对于EditText,但似乎如果我使用android:inputType,android:hint将不起作用。EditText将为空白。使用android:password和android:hint时没有这样的问题。我在这里遗漏了一些关于android:inputType的内容吗? 最佳答案

android - TextInputLayout 对在 EditText 中以编程方式给出提示无效

我有一个EditText,它的父级是TextInputLayout。我正在尝试以编程方式为EditText提供提示(不在布局中)在这种情况下,文本输入提示动画不起作用,它就像简单的EditText一样工作。有人可以建议如何处理它。下面是我的布局。 最佳答案 您必须将提示设置为TextInputLayout这是代码。TextInputLayouttextInputLayout=(TextInputLayout)findViewById(R.id.text_input_layout);textInputLayout.setHint("H

android - TextInputLayout 对在 EditText 中以编程方式给出提示无效

我有一个EditText,它的父级是TextInputLayout。我正在尝试以编程方式为EditText提供提示(不在布局中)在这种情况下,文本输入提示动画不起作用,它就像简单的EditText一样工作。有人可以建议如何处理它。下面是我的布局。 最佳答案 您必须将提示设置为TextInputLayout这是代码。TextInputLayouttextInputLayout=(TextInputLayout)findViewById(R.id.text_input_layout);textInputLayout.setHint("H

android - 有没有办法让 EditText 开始在 EditText 的左上角输入?

我有一个带有属性的EditText:android:minLines="3"但是,当我开始输入时,它会在EditText的中间输入。有什么方法可以让这个在EditText区域的左上角开始输入? 最佳答案 将android:gravity="top|left"添加到布局XML文件中的EditText。 关于android-有没有办法让EditText开始在EditText的左上角输入?,我们在StackOverflow上找到一个类似的问题: https://st

android - 有没有办法让 EditText 开始在 EditText 的左上角输入?

我有一个带有属性的EditText:android:minLines="3"但是,当我开始输入时,它会在EditText的中间输入。有什么方法可以让这个在EditText区域的左上角开始输入? 最佳答案 将android:gravity="top|left"添加到布局XML文件中的EditText。 关于android-有没有办法让EditText开始在EditText的左上角输入?,我们在StackOverflow上找到一个类似的问题: https://st

android - OnClick 事件仅在 edittext 上第二次起作用

我有一个编辑文本,当用户单击此编辑文本时,我想显示一个警报对话框。我的代码如下:edt.setInputType(InputType.TYPE_NULL);edt.setFocusableInTouchMode(true);edt.requestFocus();edt.setCursorVisible(false);edt.setOnClickListener(newOnClickListener(){publicvoidonClick(Viewv){CommentDialog.buildDialog(mContext,identifier,false,edt.getId());}})

android - OnClick 事件仅在 edittext 上第二次起作用

我有一个编辑文本,当用户单击此编辑文本时,我想显示一个警报对话框。我的代码如下:edt.setInputType(InputType.TYPE_NULL);edt.setFocusableInTouchMode(true);edt.requestFocus();edt.setCursorVisible(false);edt.setOnClickListener(newOnClickListener(){publicvoidonClick(Viewv){CommentDialog.buildDialog(mContext,identifier,false,edt.getId());}})