EditText的使用

简单、好用的自定义EditText(含一键删除&自定义样式)- https://github.com/Carson-Ho/SuperEditText

>  EditText,软键盘出现把原来的布局给顶上去
解决Andriod软键盘出现把原来的布局给顶上去的方法(转)-http://blog.csdn.net/xww810319/article/details/17397429
android:windowSoftInputMode="adjustPan|stateHidden"   android:maxLines="1"   android:singleLine="true"
> 禁止进入activity自动弹出键盘,设定activity的属性

android:windowSoftInputMode="stateHidden|stateUnchanged" 

android实用技术--修改键盘回车键显示的方案及执行动作- http://www.jianshu.com/p/7da572d16f07
Android 搜索 把软键盘上的回车键改为搜索- http://blog.csdn.net/lucky_bo/article/details/50771054?ref=myread

Android 密码校验,字符串中必须包含字母或者数字- http://blog.csdn.net/u013347784/article/details/52239026

-- 在应用中遇到一个问题:在两个页面都有EditText作为搜索框时,进入第二个页面后,键盘始终无法弹出。
需要在包含EditText的ViewGroup中设置属性: android:focusableInTouchMode="true"

> 让EditText不能自动获取焦点
<LinearLayout
        android:focusable="true"  
        android:focusableInTouchMode="true"

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/gray_light_eeeeee"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/topic_search_input"
            android:layout_width="match_parent"
            android:layout_height="40dip"
            android:layout_marginBottom="10dip"
            android:layout_marginLeft="15dip"
            android:layout_marginRight="15dip"
            android:layout_marginTop="10dip"
            android:background="@drawable/topics_type_bg"
            android:hint="话题名"
            android:padding="10dp"
            android:textSize="16sp" />
</LinearLayout>

> EditText 
4. 这里想设置的就是之前的手机icon和”请输入手机号“之间的距离,则可是使用以下的方式:android:drawablePadding="8dp"
         <EditText 
            android:id="@+id/tel_num"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="25dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:drawablePadding="8dp"
            android:drawableLeft="@drawable/phone"
            android:hint="请输入手机号码"
         />


5.Android之自定义EditText光标和下划线颜色- http://blog.csdn.net/w690333243/article/details/73559120
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size android:width="2dp" />
    <solid android:color="@android:color/holo_blue_light" />
</shape>

<EditText android:textCursorDrawable="@drawable/cursor_color"/>

android:textColorHint="#03A9F4"

> Android EditText禁止输入Emoji后设置android:maxLength失效的问题- http://xfenglin.com/a/12010764825.html
public InputFilter emojiFilter = new InputFilter() {
        @Override
        public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
            for (int index = start; index < end; index++) {
                int type = Character.getType(source.charAt(index));
                if (type == Character.SURROGATE) {
                    return "";
                }
            }
            return null;
        }
    };
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8), emojiFilter})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值