本文整理了Java中android.webkit.WebView.canGoBack()
方法的一些代码示例,展示了WebView.canGoBack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.canGoBack()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:canGoBack
暂无
代码示例来源:origin: smuyyh/BookReader
public boolean canBack() {
if (mWebView.canGoBack()) {
mWebView.goBack();
return false;
}
return true;
}
}
代码示例来源:origin: JZ-Darkal/AndroidHttpCapture
@Override
public boolean onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
return true;
} else {
return false;
}
}
代码示例来源:origin: smuyyh/BookReader
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) { // 表示按返回键
mWebView.goBack(); // 后退
// webview.goForward();//前进
return true; // 已处理
}
}
return false;
}
});
代码示例来源:origin: TommyLemon/APIJSON
@Override
public void onBackPressed() {
if (wvWebView.canGoBack()) {
wvWebView.goBack();
return;
}
super.onBackPressed();
}
代码示例来源:origin: stackoverflow.com
webView.setOnKeyListener(new OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if(event.getAction() == KeyEvent.ACTION_DOWN)
{
WebView webView = (WebView) v;
switch(keyCode)
{
case KeyEvent.KEYCODE_BACK:
if(webView.canGoBack())
{
webView.goBack();
return true;
}
break;
}
}
return false;
}
});
代码示例来源:origin: Justson/AgentWeb
@Override
public boolean back() {
if (this.mEventInterceptor != null && this.mEventInterceptor.event()) {
return true;
}
if (mWebView != null && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return false;
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
@Override
public void onBackPressed() {
if (wvWebView.canGoBack()) {
wvWebView.goBack();
return;
}
super.onBackPressed();
}
代码示例来源:origin: sunfusheng/MarqueeView
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
webView.goBack();//返回上一页面
return true;
}
return super.onKeyDown(keyCode, event);
}
代码示例来源:origin: termux/termux-app
@Override
public void onBackPressed() {
if (mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
}
}
代码示例来源:origin: sunfusheng/StickyHeaderListView
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
webView.goBack();//返回上一页面
return true;
}
return super.onKeyDown(keyCode, event);
}
代码示例来源:origin: nanchen2251/RxJava2Examples
@Override
public void onBackPressed() {
if (mWebView.canGoBack()) {
mWebView.goBack();
} else {
finish();
}
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onBackClick() {
if (webView.canGoBack()) {
webView.goBack();
return true;
}
return super.onBackClick();
}
代码示例来源:origin: rmtheis/android-ocr
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (webView.canGoBack()) {
webView.goBack();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onBackClick() {
if (mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onBackClick();
}
代码示例来源:origin: wangdan/AisenWeiBo
@Override
public boolean onBackClick() {
if (mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onBackClick();
}
代码示例来源:origin: cSploit/android
@Override
public void onBackPressed() {
if (mWebView != null && mWebView.canGoBack())
mWebView.goBack();
else {
if (mWebView != null)
mWebView.stopLoading();
super.onBackPressed();
overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
}
}
代码示例来源:origin: TheFinestArtist/FinestWebView-Android
@Override
public void onBackPressed() {
if (menuLayout.getVisibility() == View.VISIBLE) {
hideMenu();
} else if (backPressToClose || !webView.canGoBack()) {
exitActivity();
} else {
webView.goBack();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void canGoBack() throws Exception {
webView.clearHistory();
assertThat(webView.canGoBack()).isFalse();
webView.loadUrl("fake.url", null);
webView.loadUrl("fake.url", null);
assertThat(webView.canGoBack()).isTrue();
webView.goBack();
assertThat(webView.canGoBack()).isFalse();
}
代码示例来源:origin: stackoverflow.com
if (keyCode == KeyEvent.KEYCODE_BACK
&& event.getAction() == MotionEvent.ACTION_UP
&& mWeb.canGoBack()) {
handler.sendEmptyMessage(1);
return true;
mWeb.goBack();
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
public void onBackPressed() {
if (mWebView.canGoBack() && mWebView.copyBackForwardList().getSize() > 0
&& !mWebView.getUrl().equals(mWebView.copyBackForwardList()
.getItemAtIndex(0).getOriginalUrl())) {
mWebView.goBack();
} else {
finish();
}
}
内容来源于网络,如有侵权,请联系作者删除!