一.给EditText添加背景,并且4角圆弧

对应的xml 以及样式如下:

<EditText
android:id="@+id/o_item_num"
style="@style/ValueTextStyle"
android:hint="请输入服务次数"
android:layout_height="40.0dip"
android:inputType="number"
android:singleLine="true"
android:text="1" />
<style name="ValueTextStyle">
<item name="android:textSize">@dimen/txt_m</item>
<item name="android:background">@drawable/edit_bg_selector</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">15.0dip</item>
<item name="android:layout_marginTop">10.0dip</item>
<item name="android:layout_marginRight">15.0dip</item>
<item name="android:layout_marginBottom">10.0dip</item>
<item name="android:layout_centerVertical">true</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/edit_text_disable" />
<item android:state_focused="true" android:drawable="@drawable/edit_text_focused" />
<item android:state_pressed="true" android:drawable="@drawable/edit_text_focused" />
<item android:drawable="@drawable/edit_text" />
</selector>

当然还有一种方式是定义 圆弧 shape来实现

android EditText实现圆弧背景的更多相关文章

  1. Android圆弧背景

    代码改变世界 Android圆弧背景 <?xml version="1.0" encoding="utf-8"?><shape xmlns:a ...

  2. Android EditText的设置

    1.输入法Enter键图标的设置: 软件盘的界面替换只有一个属性android:imeOptions,这个属性的可以取的值有normal,actionUnspecified,actionNone,ac ...

  3. Android EditText属性

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  4. Android EditText多行显示及所有属性

    android:id="@+id/editSms" android:layout_width="fill_parent" android:layout_heig ...

  5. Android EditText的设置(转)

    1.输入法Enter键图标的设置: 软件盘的界面替换只有一个属性android:imeOptions,这个属性的可以取的值有normal,actionUnspecified,actionNone,ac ...

  6. android EditText中inputType的属性列表

    android 1.5以后添加了软件虚拟键盘的功能,所以在输入提示中将会有对应的软键盘模式 android中inputType属性在EditText输入值时启动的虚拟键盘的风格有着重要的作用.这也大大 ...

  7. Android EditText悬浮在输入法之上

    Android EditText悬浮在输入法之上 使用 android:windowSoftInputMode="adjustResize" 会让界面整体被顶上去,很多时候我们不需 ...

  8. Android 设置进度条背景

    Android 设置进度条背景 直接上代码 <ProgressBar android:id="@+id/progressBar" android:layout_width=& ...

  9. Android EditText 不弹出输入法

    当第一次进入一个activity的时候  一般是第一个edittext是默认选中的,但是该死的软键盘也一起弹出来了 那是相当的不美观哈!(#‵′)凸.为此, 本大人就去寻找在刚进入这个activity ...

随机推荐

  1. Ubuntu下安装php7.1的gd,mysql,pdo_mysql扩展库

    执行以下命令 # apt-get install php7.1-gd # apt-get install php7.0-mysql 重新启动 php7.1-fpm(因为我是安装的 Nginx 和 ph ...

  2. 【资源共享】eBook分享大集合

    传送门:[GitHub] 欢迎各位指点,要是能补充更是感激不尽. 主要以IT领域经典书籍收藏,以备不时之需,不一定都能看完,权且当做收藏好玩. [x] 表示文件大小超过100M(LFS). 服务器系统 ...

  3. python方法的使用

    1.函数定义             def  函数名(形参):                     函数体                     return   返回值   2.函数执行   ...

  4. mybatis逆向工程maven版本idea工具

    基于springboot2版本 pom基本依赖 <parent> <groupId>org.springframework.boot</groupId> <a ...

  5. 回顾js中的cookie/localstorage

    1.首先简单总结下cookie cookie:可以做会话跟踪 特点:      1.大小限制(不能超过4k)      2.每个域下cookie不能超过50个      3.有效期(和设定时间有关), ...

  6. 使用Mybatis-Generator 自动生成代码

    前提:已经有SpringBoot的工程,且在上面实现了MyBatis的应用,只不过全是以手动方式创建mapper.xml映射文件.pojo类等. 在POM中添加MyBatis.generator依赖 ...

  7. 前端优化---回流 (reflow)与 重绘(repaint)

    回流(reflow):指的是网络浏览器为了重新渲染部分或全部的文档而重新计算文档中元素的位置和几何结构的过程. 页面上节点是以树的形式展现的,我们通过js将页面上的一个节点删除,此时为了不让剩下的节点 ...

  8. Gym 101510C

    题意略. 思路: 由于xi的选取是任意的,所以我们不用去理会题目中的xi数列条件.主要是把关注点放在长度为L的线段覆盖至少k个整数这个条件上. 像这种取到最小的合法解的问题,我们应该要想到使用二分法来 ...

  9. 关于python的特殊方法

    最近在阅读<流畅的python>这本书,在第一章中作者就提到了几个python中的特殊方法,代码入下: class FrenchDuck: ranks = [str(n) for n in ...

  10. 使用mybatis-generator生成底层

    使用mybatis-generator生成底层 前言 ​ 使用springboot2,jdk1.8,idea 一.在pom引入相关依赖 <!--mybatise-generator--> ...