2016-07-12 12 views

答えて

2

だけandroiデバイス上で無効にフォーカスを行いたい場合は、ユーザー・エージェントを検出する必要があります。 https://github.com/rafaelp/css_browser_selectorを使用できます。このプラグインは、あなたのhtmlタグにユーザーエージェントを追加します

$('.android input').on('focus', function (e) { 
 
    $(this).blur(); 
 
    e.preventDefault(); 
 
    
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<input type="text"/>

0

onCreateの機能の中にあります。

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

マニフェストファイルからも行うことができます。 <activity>タグ内。

android:windowSoftInputMode="stateHidden" 
0
public static void hideSoftKeyboard(Activity activity) { 
    if (activity.getCurrentFocus() != null) { 
     InputMethodManager inputMethodManager = (InputMethodManager) activity 
       .getSystemService(Context.INPUT_METHOD_SERVICE); 
     inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); 
    } 
} 

public static void hideSoftKeyboard(Fragment fragment) { 
    if (fragment.getActivity().getCurrentFocus() != null) { 
     InputMethodManager inputMethodManager = (InputMethodManager) fragment.getActivity() 
       .getSystemService(Context.INPUT_METHOD_SERVICE); 
     inputMethodManager.hideSoftInputFromWindow(fragment.getActivity().getCurrentFocus().getWindowToken(), 0); 
    } 
} 
+0

いいえ、あなたはHTMLまたはJSのどちらかについて言及しましたか? – dominicd

関連する問題