Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-如何将背景文本放入EditText?_Android_Xml_Text_Background_Android Edittext - Fatal编程技术网

Android-如何将背景文本放入EditText?

Android-如何将背景文本放入EditText?,android,xml,text,background,android-edittext,Android,Xml,Text,Background,Android Edittext,我已将EditText放入XML中。 我想使用此EditText来插入用户的姓名 我希望在这个编辑文本中出现文本“插入名称”,但是当用户单击它时,“插入名称”文本消失,因此用户不需要删除短语“插入名称” 我希望在此图像中具有相同的“事件名称”效果: 在EditText中需要做什么才能获得这种效果? 谢谢 这将有助于: 通过使用以下程序进行编程: myEditText.clearFocus(); 用实际文本填充它 或xml: android:hint="text here" 哪个是不可选择

我已将EditText放入XML中。 我想使用此EditText来插入用户的姓名

我希望在这个编辑文本中出现文本“插入名称”,但是当用户单击它时,“插入名称”文本消失,因此用户不需要删除短语“插入名称”

我希望在此图像中具有相同的“事件名称”效果:

在EditText中需要做什么才能获得这种效果? 谢谢

这将有助于:

通过使用以下程序进行编程:

myEditText.clearFocus();
用实际文本填充它

或xml:

android:hint="text here"

哪个是不可选择的灰显“提示”文本,您希望在xml文件的EditText中添加提示

<EditText
    android:id="@+id/etName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Insert Name"/>


被调用来提示
android:hint=“Event name”
在EditText中设置将其放入XML的EditText中android:hint=“插入名称”非常感谢,我找到了解决方案非常感谢!谢谢你的支持