簡體   English   中英

當軟鍵盤顯示並通過Adjust Pan隱藏在Phonegap / Android中時,如何獲取鍵盤事件

[英]How can I get a keyboard event when soft keyboard show's & hide in Phonegap/Android with Adjust Pan

我無法在Android移動設備上打開和關閉鍵盤事件。 也嘗試使用“無調整”選項,但相同的結果無法獲取事件。

我在AndroidManifest.xml中編寫的一部分代碼

<activity
        android:name=".wlimbuat62"
        android:configChanges="orientation|keyboardHidden|keyboard"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustNothing" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.wlimbuat62.wlimbuat62.NOTIFICATION" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
</activity>

您需要檢查Configuration.HARDKEYBOARDHIDDEN_NOConfiguration.HARDKEYBOARDHIDDEN_YES

這里給出的示例一樣,也請參見下面的示例代碼:

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // Checks the orientation of the screen
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM