EditText提示文字

如图,在没有输入文字前,会显示提醒文字。
引用的是文本文件(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提示文字的更多相关文章
- 去掉hint提示文字
想要去掉EditText的hint提示文字,首先需要给EditText的父控件加上如下两个属性,使其获得焦点: android:focusable="true" android:f ...
- HTML5轻松实现搜索框提示文字点击消失---及placeholder颜色的设置
在做搜索框的时候无意间发现html5的input里有个placeholder属性能轻松实现提示文字点击消失功能,之前还傻傻的在用js来实现类似功能... 示例 <form action=&quo ...
- ASP.NET TextBox 当鼠标点击后清空默认提示文字
ASP.NET TextBox 当鼠标点击后清空默认提示文字 [ 方法一] 前台代码: <div> <asp:TextBox ID="txtName" ru ...
- ASP.NET TextBox 当鼠标点击后清空默认提示文字[转]
前台文本框里添加下面2个事件属性: OnFocus="javascript:if(this.value=='提示文字') {this.value=''}" OnBlur=" ...
- <textarea>输入框提示文字
背景 看了过时的资料,花费大把时间,不过也有收获,还是写写吧! 分析 有同学可能想到直接在<textarea>标签内输入帮助文字,但是这又有一个新问题--因为<textarea> ...
- input 标签实现带提示文字的输入框
方法一:html5配合css3实现带提示文字的输入框(摆脱js): webkit特有的一个css,可以控制里面的文字样式,配合css3的动画效果和伪类,我们就可以很容易做出一个带动画的输入框,在系统登 ...
- html5文本框提示文字属性为placeholder
html5文本框提示文字属性为placeholder 例子: <textarea id="comment" class="commentCont" n ...
- jquery实现密码框显示提示文字
jquery实现密码框提示文字的功能. 代码: <html> <head> 3 <title>登录-jquery实现密码框显示文字-www.jbxue. ...
- Unity3D基础学习 NGUI自带Tooltip制作提示文字
简介 NGUI自带的的例子Character中含有一个Tooltip,可以鼠标悬浮到某对象时显示提示文字.非常方便. 创建UITooltip 首先你需要在场景NGUi相机下建立一个空物体我把它命名为T ...
随机推荐
- C语言中随机数相关问题
用C语言产生随机数重要用到rand函数.srand函数.及宏RAND_MAX(32767),它们均在stdlib.h中进行了声明. int rand(void);//生成一个随机数 voidsrand ...
- IoC 之 2.3 IoC的配置使用(叁)
2.3.1 XML配置的结构 一般配置文件结构如下: <beans> <import resource="resource1.xml"/> <bea ...
- css3实现超过两行文字,超出用三个点显示(兼容性不行,仅供学习)
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> ...
- Python--关于dict
慕课网<Python 入门>学习笔记 1.dict 特性 dict用花括号{}表示,然后按照 key: value, 写出来即可.最后一个 key: value 的逗号可以省略. ①.di ...
- Qt之QParallelAnimationGroup
简述 QParallelAnimationGroup类提供动画的并行组. QParallelAnimationGroup - 一个动画容器,当它启动的时候它里面的所有动画也启动,即:并行运行所有动画, ...
- PHP中的CURL函数库
PHP中的CURL函数库(Client URL Library Function) curl_close — 关闭一个curl会话curl_copy_handle — 拷贝一个curl连接资源的所有内 ...
- 集成 Apple Pay
作者感言 在中秋过后终于把国内的三大支付平台SDK集成都搞定了, 现在我们终于可以来研究Apple自家的支付Apple Pay最后:如果你有更好的建议或者对这篇文章有不满的地方, 请联系我, 我会参考 ...
- 声明式编程——抽象程度更高,关注是什么(what),而非如何做(how)
CSDN:AngularJS的设计理念是什么?灵感来自于什么? Misko:AngularJS遵循的设计理念是--构建UI应该是声明式的.这也是AngularJS中标识符(directives)想法的 ...
- XHR2 和[FromBody]使用说明
[FromBody]必须是application/json 否则会报415 不支持的类型 //Forms function FormsPost(data) { //Default Type x-www ...
- [转载]DataSet导入到Excel文件
/// <summary> /// 将数据导入到Excel /// </summary> /// <param name="ds"& ...