检测上的EditText触摸,但不会中断呢? [英] Detect touch on EditText, but not interrupt it?

查看:113
本文介绍了检测上的EditText触摸,但不会中断呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道当用户触摸/水龙头/点击的EditText在我的活动。

我怎么能做到这一点不中断的事件,所以键盘仍显示正常吗?

(我需要了解它的操作系统显示键盘前......如果可能的话)

解决方案

  txtEdit.setOnTouchListener(新View.OnTouchListener(){
    公共布尔onTouch(查看视图,MotionEvent motionEvent){
         //你的code这里....
         。getWindow()setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
         返回false;
    }
});
 

I need to know when the user touches/taps/clicks the edittext in my activity.

How can I do this without interrupting the events, so the keypad still displays properly?

(And I need to know about it before the OS displays the keypad...if possible)

解决方案

txtEdit.setOnTouchListener(new View.OnTouchListener(){
    public boolean onTouch(View view, MotionEvent motionEvent) {                                                       
         // your code here....
         getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);                
         return false;
    }
});

这篇关于检测上的EditText触摸,但不会中断呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆