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 ...
随机推荐
- iOS 使用drawRect: 绘制虚线椭圆
iOS 使用drawRect: 绘制虚线椭圆 1:首先如果要使用 drawRect 绘图 要导入 CoreGraphics.framework 框架 然后 创建 自定义view, 即是 myView继 ...
- virtualbox macosx10.9改变分辨率方法
VBoxManage setextradata "osx10.9" VBoxInternal2/EfiGopMode 5 VBoxManage setextradata " ...
- 【Problem solved】发现输入法都是仅桌面使用,无法输入中文时
你打开命令提示符输入CTFMON就可以啦.
- word-break:break-all和word-wrap:break-word的区别
了解word-break属性 /* 关键字值 */ word-break: normal; word-break: break-all; word-break: keep-all; /* 全局值 */ ...
- php Composer 报ssl证书错误
CA证书下载地址:http://curl.haxx.se/docs/caextract.html 修改php.ini文件 openssl.cafile= D:/wamp/php/verify/cace ...
- 布局两列div等高方法
一.左右布局,左侧div绝对定位,外div相对定位 <!DOCTYPE html> <html lang="en"> <head> <me ...
- HDUOJ----2485 Destroying the bus stations(2008北京现场赛A题)
Destroying the bus stations ...
- html5的标签
1.article与section div的区别 当一个标签只是为了样式化或者方便脚本使用时,应该使用 div . section 表示一段专题性的内容,一般会带有标题.,section 应用的典型场 ...
- 报错总结_java.lang.RuntimeException: Invalid action class configuration that references an unknown class name
在使用SSH进行项目开发时,一不小心就可能出现以上的错误提示. 这样的问题可以简单理解为未找到名字为XXX的action 1)xxxAction没有在Struts.xml中配置相应的action: 大 ...
- ABAP版连连看
网上看到的,感觉不错,借来装13... *&---------------------------------------------------------------------* *&a ...