|
1 | 1 | # ExtendEditText
|
2 |
| -1.0.0 |
| 2 | + |
| 3 | +支持一键清除,内容匹配的输入框 |
| 4 | + |
| 5 | +## 运行效果 |
| 6 | + |
| 7 | + |
| 8 | +## 如何使用 |
| 9 | + |
| 10 | +打开工程根目录build.gradle |
| 11 | +``` |
| 12 | +allprojects { |
| 13 | + repositories { |
| 14 | + jcenter() |
| 15 | + //添加内容 |
| 16 | + maven { url 'https://jitpack.io' } |
| 17 | + } |
| 18 | +} |
| 19 | +``` |
| 20 | +打开依赖Module中的build.gradle |
| 21 | +``` |
| 22 | +compile 'com.github.samuelhuahui:ExtendEditText:1.0.1' |
| 23 | +``` |
| 24 | + |
| 25 | +打开使用的布局 |
| 26 | +``` |
| 27 | + <com.huaye.extendedittext.ExtendEditText |
| 28 | + android:layout_width="260dp" |
| 29 | + android:layout_height="60dp"/> |
| 30 | +
|
| 31 | + <com.huaye.extendedittext.ExtendEditText |
| 32 | + android:layout_width="260dp" |
| 33 | + android:layout_height="60dp" |
| 34 | + android:layout_marginTop="30dp" |
| 35 | + app:extend_regex="^[1]\\d{10}$" |
| 36 | + android:hint="请输入手机号"/> |
| 37 | + |
| 38 | + <com.huaye.extendedittext.ExtendEditText |
| 39 | + android:layout_width="260dp" |
| 40 | + android:layout_height="60dp" |
| 41 | + android:layout_marginTop="30dp" |
| 42 | + app:extend_regex="^[1]\\d{10}$" // 设置匹配正则 |
| 43 | + app:extend_icon_ok="" //设置匹配图标 |
| 44 | + app:extend_icon_clear="" //设置清图片 |
| 45 | + android:hint="请输入手机号"/> |
| 46 | +``` |
| 47 | +## 说明: |
| 48 | +1. 比设置extend_regex值,则右侧一直显示为圆差 |
| 49 | +2. 更换右侧图片也可以通过updateRightDrawable() |
| 50 | +3. setOnMatchListener匹配回调 |
| 51 | +4. setOnClearListener清空回调,如果匹配了,则清空失效 |
| 52 | +5. 统一监听setOnTextChangedListener,为了避免多处添加监听,这里重新添加字符改变后的回调。 |
| 53 | + |
| 54 | +## License |
| 55 | +```The MIT License (MIT) |
| 56 | + |
| 57 | + Copyright (c) 2016 samuelhuahui |
| 58 | + |
| 59 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 60 | + of this software and associated documentation files (the "Software"), to deal |
| 61 | + in the Software without restriction, including without limitation the rights |
| 62 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 63 | + copies of the Software, and to permit persons to whom the Software is |
| 64 | + furnished to do so, subject to the following conditions: |
| 65 | + |
| 66 | + The above copyright notice and this permission notice shall be included in all |
| 67 | + copies or substantial portions of the Software. |
| 68 | + |
| 69 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 70 | + |
| 71 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 72 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 73 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 74 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 75 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 76 | + SOFTWARE. |
| 77 | + ``` |
0 commit comments