@Mahtias Lin, consultare il mio codice per creare e utilizzare WebView;
WebView webView = new WebView(this);
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, 416);
WebSettings webSettings = webView.getSettings();
webSettings.setSavePassword(false);
webSettings.setSaveFormData(false);
webSettings.setJavaScriptEnabled(true);
webView.setLayoutParams(p);
webView.loadUrl("http://www.google.com/");
Sopra il codice non è impostata la mia webview a 416px altezza.
@CommonsWare, ho provato il tuo suggerito con il seguente codice e funziona incredibilmente, grazie.
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return false;
}
});
Ma questo utilizzo ha portato alcuni nuovi problemi. Quando eseguo l'override di shouldOverrideURLLadadd, la visualizzazione Web viene visualizzata con no-addressbar, no-navigation (back, forward ecc ...)?
E inoltre, la webview non accetta input utente?
Ok, io sono l'editing mia domanda :)
ho cercato e ho trovato il seguente set supplementare per rendere WebView per grado di ottenere ingressi;
webView.requestFocus(View.FOCUS_DOWN);
D'altra parte, credo creerò la mia schiena, pulsanti avanti e l'indirizzo-bar per il mio WebView. Allegherò anche "cosa è successo" a questo thread quando creo i miei pulsanti e la barra degli indirizzi.
migliore,
btw: le stesse domande sembrano essere qui: http://stackoverflow.com/questions/3321958/how-use-a-webview-without-expand-and-without-interaction –
@ mathias-lin: link is dead –