如图,在没有输入文字前,会显示提醒文字。

引用的是文本文件(strings.xml)中的对应文字

activity_main.xml对应的红色代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="examples.ouc.com.myapplication2.MainActivity"
tools:showIn="@layout/activity_main"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:id="@+id/textView" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/etUser"
android:hint="@string/hint_etUser"
android:layout_below="@+id/textView"
android:layout_alignParentEnd="true" />
<EditText
android:id="@+id/etPassword"
android:hint="@string/hint_etPassword"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/etUser"
android:layout_alignParentEnd="true" />
</RelativeLayout>

strings.xml中对应的代码为:

 <resources>
<string name="app_name">My Application2</string>
<string name="action_settings">Settings</string>
<string name="hint_etUser">User Name</string>
<string name="hint_etPassword">Password</string>
<string name="hint_btSubmit">Submit</string>
<string name="text_btClear">Clear</string>
<string name="hint_etPhone">Phone Number</string>
<string name="hint_etAge">Age</string>
<string name="msg_ClearAllFields">clear all the fields</string>
</resources>

EditText提示文字的更多相关文章

  1. 去掉hint提示文字

    想要去掉EditText的hint提示文字,首先需要给EditText的父控件加上如下两个属性,使其获得焦点: android:focusable="true" android:f ...

  2. HTML5轻松实现搜索框提示文字点击消失---及placeholder颜色的设置

    在做搜索框的时候无意间发现html5的input里有个placeholder属性能轻松实现提示文字点击消失功能,之前还傻傻的在用js来实现类似功能... 示例 <form action=&quo ...

  3. ASP.NET TextBox 当鼠标点击后清空默认提示文字

    ASP.NET TextBox 当鼠标点击后清空默认提示文字 [ 方法一] 前台代码: <div>    <asp:TextBox ID="txtName" ru ...

  4. ASP.NET TextBox 当鼠标点击后清空默认提示文字[转]

    前台文本框里添加下面2个事件属性: OnFocus="javascript:if(this.value=='提示文字') {this.value=''}" OnBlur=" ...

  5. <textarea>输入框提示文字

    背景 看了过时的资料,花费大把时间,不过也有收获,还是写写吧! 分析 有同学可能想到直接在<textarea>标签内输入帮助文字,但是这又有一个新问题--因为<textarea> ...

  6. input 标签实现带提示文字的输入框

    方法一:html5配合css3实现带提示文字的输入框(摆脱js): webkit特有的一个css,可以控制里面的文字样式,配合css3的动画效果和伪类,我们就可以很容易做出一个带动画的输入框,在系统登 ...

  7. html5文本框提示文字属性为placeholder

    html5文本框提示文字属性为placeholder 例子:  <textarea id="comment" class="commentCont"  n ...

  8. jquery实现密码框显示提示文字

    jquery实现密码框提示文字的功能. 代码:    <html>  <head>   3 <title>登录-jquery实现密码框显示文字-www.jbxue. ...

  9. Unity3D基础学习 NGUI自带Tooltip制作提示文字

    简介 NGUI自带的的例子Character中含有一个Tooltip,可以鼠标悬浮到某对象时显示提示文字.非常方便. 创建UITooltip 首先你需要在场景NGUi相机下建立一个空物体我把它命名为T ...

随机推荐

  1. 安卓App热补丁动态修复技术介绍

    版权声明:本文由johncz原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/169 来源:腾云阁 https://www.q ...

  2. C#高级知识点概要(2) - 线程和并发

    原文地址:http://www.cnblogs.com/Leo_wl/p/4192935.html 我也想过跳过C#高级知识点概要直接讲MVC,但经过前思后想,还是觉得有必要讲的.我希望通过自己的经验 ...

  3. 5.4.1 Selenium2启动空浏览器

    在Web自动化测试中,必须考虑不同浏览器对网站的兼容性测试,所以我们首先介绍如何用webDriver代码打开不同的浏览器. 本节介绍的是在Selenium2启动浏览器时,启动一个干净的没有任务插件及c ...

  4. FireFox背景亮度修改

    安装stylish 输入:body{filter: brightness(80%);}

  5. 问题解决The connection to adb is down, and a severe error has occured.

    遇到问题描述: 运行android程序控制台输出 [2013-06-25 11:10:32 - MyWellnessTracker] The connection to adb is down, an ...

  6. 数据库索引<二> 补充前篇

    你要准备的软件有: 最新版 Rsync for windows 服务端:cwRsync_Server_2.1.5_Installer.zip 客户端:cwRsync_2.1.5_Installer.z ...

  7. uva 11624(bfs)

    11624 - Fire! Time limit: 1.000 seconds Joe works in a maze. Unfortunately, portions of the maze hav ...

  8. CentOS 常用命令大全(2)

    系统 # uname -a               # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue   # 查看操作系统版本 # cat /proc/cpuinf ...

  9. 解决ACTIVITI流程图设置字体不生效的问题

    在ACTIVITI 5.15的版本中,有一个设置流程图的字体配置. 配置如下: <bean id="processEngineConfiguration" class=&qu ...

  10. Floyd 算法的动态规划本质

    [转载自:http://www.cnblogs.com/chenying99/p/3932877.html] Floyd–Warshall(简称Floyd算法)是一种著名的解决任意两点间的最短路径(A ...