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