某些文本框位於網站中,但在其上點按並不顯示軟鍵盤。某些灰色部分位於顯示屏的下方,看起來像像鍵盤正在隱藏behing。請幫助我解決這個問題。在webview應用程序中點按textfield並不會在我的webview應用程序中顯示軟鍵盤
WebActivity.java
package com.example.samworkshops;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebActivity extends Activity {
public WebView webview;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new WebViewClient());
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.loadUrl("http://app.samworkshops.org");
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
webview.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
}
üR IN模擬器或設備檢查? –
嗨給了一個答案,希望它能爲你工作 –
它是否適合你? –