android获取编辑框的最大长度
来源:互联网 发布:杭州淘宝城地址在哪里 编辑:程序博客网 时间:2024/05/23 02:06
//通过反射方式曲线获得最大的长度的
public static int getMaxLength(EditText et){
int length =0;
try{
InputFilter[] inputFilters = et.getFilters();
for(InputFilter filter : inputFilters){
Class<?> c = filter.getClass();
if(c.getName().equals("android.text.InputFilter$LengthFilter"){
Field[] f = c.getDeclaredFields();
for(Field field :f){
if(Field field : f ){
if(field.getName().euqals("mMax"){
field.setAccessible(true);
length = (Integer) field.get(filter);
}
}
}
}
}catch(Exception e){
e.printStackTrace();
}
return length;
}
}
阅读全文
0 0
- android获取编辑框的最大长度
- 如何获取shell的最大命令行长度
- 如何获取shell的最大命令行长度
- android获取字符串的长度
- Android获取TextView的长度
- Android获取TextView的长度
- 获取最大长度存在巅倒字符串的子串
- 比较List<String>中元素,获取长度最大的元素。
- android 获取图片的长度和宽度
- PING的最大长度
- URL 的最大长度
- Varchar的最大长度
- varchar2 的最大长度
- String的最大长度
- android 修改版本号最大长度
- Android BLE中传输数据的最大长度怎么破
- Android BLE中传输数据的最大长度怎么破
- 设置GridView编辑框长度
- LeetCode (236):Lowest Common Ancestor of a Binary Search Tree
- Unity3d之截图方法
- LeetCode (262):Nim Game
- LeetCode (238):Product of Array Except Self
- LeetCode(144):Binary Tree Preorder Traversal
- android获取编辑框的最大长度
- Leetcode(93): Restore IP Addresses
- Java使用BigDecimal解决精确计算的问题
- Socket通信原理
- 回顾:计算机网络之传输协议
- 使用Vue-cli快速搭建项目
- 解决使用eclipse创建maven web项目时报Could not resolve archetype的问题
- 树的层次遍历(Java代码实现)
- 数据智能:工具之王