SoFunction
Updated on 2025-04-07

Detailed explanation of the example of Android blocking soft keyboard and displaying cursor

Detailed explanation of the example of Android blocking soft keyboard and displaying cursor

If it is Android 4.0 or below, then

(InputType.TYPE_NULL);  

That's enough, and the soft keyboard is blocked above android 4.0 and has a cursor, so it needs to be used.

if (.SDK_INT <= 10) {//Below 4.0 danielinbiti        (InputType.TYPE_NULL);  
      } else {  
        ().setSoftInputMode(  
            .SOFT_INPUT_STATE_ALWAYS_HIDDEN);  
        try {  
          Class<EditText> cls = ;  
          Method setShowSoftInputOnFocus;  
          setShowSoftInputOnFocus = ("setShowSoftInputOnFocus",  
              );  
          (true);  
          (editText, false);  
        } catch (Exception e) {  
          ();  
        }   
      }  


If you have any questions, please leave a message or go to the community of this site to exchange and discuss. Thank you for reading. I hope it can help you. Thank you for your support for this site!