Android EditText光标颜色 与inputType

1、EditText有一个属性:android:textCursorDrawable,这个属性是用来控制光标颜色的

android:textCursorDrawable="@null","@null"作用是让光标颜色和text color一样

2、android 1.5以后添加了软件虚拟键盘的功能,所以在输入提示中将会有对应的软键盘模式
android中inputType属性在EditText输入值时启动的虚拟键盘的风格有着重要的作用。这也大大的方便的操作。有时需要虚拟键盘只为字符或只为数字。所以inputType尤为重要。
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content"android:inputType="phone" />
//文本类型,多为大写、小写和数字符号。
    android:inputType="none"
    android:inputType="text"
    android:inputType="textCapCharacters" 字母大写
    android:inputType="textCapWords" 首字母大写
    android:inputType="textCapSentences" 仅第一个字母大写
    android:inputType="textAutoCorrect" 自动完成
    android:inputType="textAutoComplete" 自动完成
    android:inputType="textMultiLine" 多行输入
    android:inputType="textImeMultiLine" 输入法多行(如果支持)
    android:inputType="textNoSuggestions" 不提示
    android:inputType="textUri" 网址
    android:inputType="textEmailAddress" 电子邮件地址
    android:inputType="textEmailSubject" 邮件主题
    android:inputType="textShortMessage" 短讯
    android:inputType="textLongMessage" 长信息
    android:inputType="textPersonName" 人名
    android:inputType="textPostalAddress" 地址
    android:inputType="textPassword" 密码
    android:inputType="textVisiblePassword" 可见密码
    android:inputType="textWebEditText" 作为网页表单的文本
    android:inputType="textFilter" 文本筛选过滤
    android:inputType="textPhonetic" 拼音输入
//数值类型
    android:inputType="number" 数字
    android:inputType="numberSigned" 带符号数字格式
    android:inputType="numberDecimal" 带小数点的浮点格式
    android:inputType="phone" 拨号键盘
    android:inputType="datetime" 时间日期
    android:inputType="date" 日期键盘
    android:inputType="time" 时间键盘

Android EditText光标颜色 与inputType

时间: 2024-12-15 11:29:58

Android EditText光标颜色 与inputType的相关文章

修改Android EditText光标颜色

EditText有一个属性:android:textCursorDrawable,这个属性是用来控制光标颜色的 android:textCursorDrawable="@null","@null"作用是让光标颜色和text color一样 修改Android EditText光标颜色

Android自定义TextView的Shape,修改EditText光标颜色

先看一下效果图: 代码实现: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 实心 --> <solid android:color="@android:color/white" /> <!-- 边框

EditText光标颜色设置

又一次做应用,发现EditText没有显示光标,借鉴了网上的方法,发现是因为光标是白色的,与背景一样造成的,这里记录一下如何设置EditText等的光标颜色: 需要在布局文件中指定androd:textCursorDrawable,如果需要设置成与字体一样的颜色,改属性设置为“@null”即可,如果需要自定义颜色,需要自定义一个drawable文件,例如:在drawable下窗井my_cursor.xml,内容如下 <?xml version="1.0" encoding=&qu

Android EditText 光标样式设置

android不同手机对于edittext光标显示样式不一,所以如果设置不同手机显示一样的效果呢,统一设置一个样式就可以了,示例代码如下: <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:textCursorDrawable="@drawable/color_cursor"/> 样式文件: <?xm

android EditText光标位置(定位到最后)

方法:edittext.setSelection(int); et.setText(content);//设置EditText控件的内容et.setSelection(content.length());//将光标移至文字末尾 (转自:http://blog.csdn.net/sww_simpcity/article/details/8949374)

解决android手机EditText设置光标颜色,android:textCursorDrawable=&quot;@drawable/corner_cursor&quot; 华为手机无效果的问题

<EditText android:id="@+id/alertdialog_zhuan_zeng_friend_phone_Edt" android:layout_width="match_parent" android:layout_height="40dp" android:textCursorDrawable="@drawable/corner_cursor" android:singleLine="t

Android之自定义EditText光标和下划线颜色

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Android之自定义EditText光标和下划线颜色 - Lindroid的博客 - 博客频道 - CSDN.NET Lindroid的博客 不积跬步,无以至千里. 目录视图 摘要视图 订阅 [活动]2017 CSDN博客专栏评选 &nbsp [5月书讯]流畅的Py

android 设置字体颜色、EditText自动输入转换成大写字母的多种方式

在TextView上面设置某一个字的字体颜色为指定颜色时,可以通过java类SpannableString类和Html语言来实现. (一)SpannableString类方式 private void setText(TextView t){ String text = t.getText().toString().trim(); SpannableString span = new SpannableString(text); span.setSpan(new ForegroundColorS

EditText 光标的颜色

EditText有一个属性:android:textCursorDrawable,这个属性是用来控制光标颜色的 android:textCursorDrawable="@null","@null"作用是让光标颜色和textcolor一样 PS: textcursordrawable 在framework 的textview 中有这个 它代表的就是光标,是一张点9图片 ,只要去换这张图片可以了 这张图片在framework/core/res/res/values/th