<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"

最新文章

  1. BZOJ 1212: [HNOI2004]L语言 [AC自动机 DP]
  2. CSS效果集锦(持续更新中)
  3. git .gitignore
  4. 用JS控制video暂停再播放
  5. Supesite 参数说明
  6. arranging-coins
  7. CS 和 BS 的区别和优缺点
  8. 設定 Bootstrap/SASS/Bower/gulp (Windows平台)
  9. Java [leetcode 22]Generate Parentheses
  10. c# Unicode字符串的解码
  11. Java于 初始化序列?
  12. HTML 5入门知识——Drag
  13. mysql单表多表查询
  14. [tkinter]为列表框添加滚动条
  15. MongoDB - 1
  16. PHP大数据处理要注意的
  17. java基础-day1
  18. elasticdump
  19. 【Matplotlib】概要总览第一讲
  20. AP*更新供应商地点

热门文章

  1. 搭建Mantis 缺陷管理系统
  2. thinkphp的model模型的设计经验总结
  3. MySQL安装--ubuntu
  4. hdu_2899_Strange fuction(三分查找)
  5. OpenCV ——双线性插值(Bilinear interpolation)
  6. OpenCV ——背景建模之CodeBook(2)
  7. 15分钟快速开发一个kissy组件(流程篇)
  8. Ubuntu DNS bind9 配置
  9. c++面试题【转】
  10. centos配置samba