public boolean onKeyDown ( int keyCode , KeyEvent event ) {
LogUtil . i ( this , "keyCode=" keyCode );
if (( keyCode == KeyEvent . KEYCODE_BACK ) && mWebView . canGoBack ()) {
mWebView . goBack ();
return true ;
}
return super . onKeyDown ( keyCode , event );
}
置android WebView 不顯示滾動條
android:scrollbars="none"
重寫shouldOverrideUrlLoading時指定url
指定只有url裡包含自己的網址的時候才在webview裡打開,否則還是啟動瀏覽器打開.
@Override
public boolean shouldOverrideUrlLoading ( WebView view , String url ) {
LogUtil . i ( this , "url=" url );
if ( url . contains ( "eoe.cn" ) == true ){
view . loadUrl ( url );
return true ;
} else {
Intent in = new Intent ( Intent . ACTION_VIEW , Uri . parse ( url ));
startActivity ( in );
return true ;
}
}
android:scrollbarStyle控制滾動條位置
mWebView . setScrollBarStyle ( View . SCROLLBARS_INSIDE_OVERLAY );
沒有留言:
張貼留言