Android之EditText控件
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLength="4" //限制我们的输入字数
android:singleLine="true" //限制我们输入框满后是否换行,true表示不换行
android:inputType="number" //限制我们输入数据类型,number只表示输入数字
android:hint="这里只允许输入数字" //在输入框中提示我们要输入的信息
android:drawableLeft="@drawable/title" //在文本框最左面显示一张名为title的图片,图片事先复制到drawable里面title.jpg
/>
改变输入框的形状
1、在drawable中新建一个shape.xml,放入下列代码
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--填充颜色-->
<solid android:color="#FFFFFF"/>
<!--设置矩形的四个角为弧线-->
<!--android:radius 弧形的半径-->
<corners android:radius="7dip"/>
</shape>
2、在main.xml<EditText 中加入
android:background="@drawable/shape"
Android之EditText控件的更多相关文章
- 【我的Android进阶之旅】如何隐藏Android中EditText控件的默认下划线
Android EditText控件是经常使用的控件,但是有时候我们并不需要它的一些默认的属性,比如说下划线,因为有时候这样的默认下划线看起来特别怪异,和其他控件在一起搭配的时候不协调,因此有时候就需 ...
- Android EditText控件行尾为表情时的BUG
今天处理项目上的一个诡异BUG,贴吧Android客户端发贴框是支持表情文字混排的,但是当发贴框的行内容末尾为表情时,尝试在表情后插入文字,就悲剧了:文字其实写进去了,但是不会显示出来.研究了一下,发 ...
- EditText控件实现只读
android的EditText控件实现只读只需设置三个方法: editText.setCursorVisible(false);//隐藏光标 editText.setFocusable(fals ...
- Android 动态背景的实现以及SurfaceView中添加EditText控件
首先还是一贯作风,我们先看案例: \ 静态图看不出来效果,如果用过此软件(扎客)的同学们都知道,她的背景会动.怎么样,是不是觉得很时尚,起码比静态的要好(个人观点).其实实现起来并不复杂,这个如果让做 ...
- MaterialEditText——Android Material Design EditText控件
MaterialEditText是Android Material Design EditText控件.可以定制浮动标签.主要颜色.默认的错误颜色等. 随着 Material Design 的到来, ...
- android开发 软键盘出现后 防止EditText控件遮挡 总体平移UI
在EditText控件接近底部的情况下 软键盘弹出后会把获得焦点的EditText控件遮挡 无法看到输入信息 防止这种情况发生 就须要设置AndroidManifest.xml的属性 前面的xml信 ...
- Android 中常见控件的介绍和使用
1 TextView文本框 1.1 TextView类的结构 TextView 是用于显示字符串的组件,对于用户来说就是屏幕中一块用于显示文本的区域.TextView类的层次关系如下: java.la ...
- 【转】Android M新控件之FloatingActionButton,TextInputLayout,Snackbar,TabLayout的使用
Android M新控件之FloatingActionButton,TextInputLayout,Snackbar,TabLayout的使用 分类: Android UI2015-06-15 16: ...
- 【风马一族_Android】第4章Android常用基本控件
第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...
随机推荐
- nginx 实现Web应用程序的负载均衡
文章转载自 博客园, 原文地址 http://www.cnblogs.com/ivanyb/archive/2011/11/16/2250710.html 看到园子中的大牛代震军写的一篇玩玩负载均衡- ...
- Chapter 1 First Sight——36
The door opened again, and the cold wind suddenly gusted through the room, rustling the papers on th ...
- JS进阶书籍
http://blog.csdn.net/bingqingsuimeng/article/details/40535291 本来想尝试每天回答或看已解决的3个问题来学习总结今天的知识点,看了下博文里面 ...
- hdu_5792_World is Exploding(树状数组+逆序对)
题目链接:hdu_5792_World is Exploding 题意: 给你一个数列,让你找有多少个(a,b,c,d)满足a≠b≠c≠d,1≤a<b≤n,1≤c<d≤n,Aa<Ab ...
- IT人为什么难以拿到高薪?【转帖】
最近在论坛里看到很多人发牢骚,说薪水少,可在我看来,你们这样的人拿得到高薪才怪! 我先问一句:这里有多少人是本科的?有多少人是正规本科的(不算自考,成考和专升本)?有多少人是有学位的?有多少有学位的是 ...
- ios 中NSArray
// #import <Foundation/Foundation.h> #import "Animal.h" int main(int argc, const cha ...
- 修改NavigationBar样式
iOS Tip: Change Status Bar Icon & Text Colors When iOS 7 was introduced Apple allowed your appli ...
- iOS 导航栏去阴影
if ([[[UIDevicecurrentDevice] systemVersion] floatValue] >= 6.0) { // 首先要判断版本号,否则在iOS 6 以下的版本会闪退 ...
- One-Way Reform
One-Way Reform time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- mysql char varchar 区别
数据库建表 字符串字段类型的选择 char与varchar的区别: char 长度固定,char(M)类型的数据列里,每个值都占用M个字节,如果某个长度小于M,MySQL就会在它的右边用空 ...