返回
顶部

修改密码

Android EditText 状态切换

+1

-1

收藏

+1

-1

点赞0

评论0

不可编辑状态 可编辑状态ed_adress.setFocusable(true);ed_adress.requestFocus();ed_adress.setFocusableInTouchMode(true);完美解决别忘了关闭键盘进入不可编辑状态的时候InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); …
 
不可编辑状态
<EditText
                    android:id="@+id/ed_newPwd"
                    android:layout_width="80dp"
                    android:layout_height="50dp"
                    android:focusable="false"/>
 
可编辑状态
ed_adress.setFocusable(true);
ed_adress.requestFocus();
ed_adress.setFocusableInTouchMode(true);
完美解决
别忘了关闭键盘进入不可编辑状态的时候
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);  
//得到InputMethodManager的实例
if (imm.isActive()) {
//如果开启
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); 
//关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的
}

扫一扫在手机打开

评论
已有0条评论
0/150
提交
热门评论
相关推荐
今日要闻
换一批
热点排行