我想删除这个div:
<div data-role="navbar" data-iconpos="bottom" class="ui-navbar" role="navigation">
<ul class="ui-grid-b">
<li class="ui-block-a">
<a href="http://www.siverekhaber.net/mobil/galeriler.html" data-icon="camera"
class="ui-link ui-btn ui-icon-camera ui-btn-icon-bottom">Galeri</a>
</li>
<li class="ui-block-b">
<a href="http://www.siverekhaber.net/mobil/videolar.html" data-icon="video"
class="ui-link ui-btn ui-icon-video ui-btn-icon-bottom">Video</a>
</li>
<li class="ui-block-c">
<a href="http://www.siverekhaber.net/mobil/yazarlar.html" data-icon="edit"
class="ui-link ui-btn ui-icon-edit ui-btn-icon-bottom">Yazarlar</a>
</li>
</ul>
</div>
我尝试重写onPageFinished
方法:
@Override
public void onPageFinished(WebView view, String url) {
view.setVisibility(View.VISIBLE);
final Animation fade = new AlphaAnimation(0.0f, 1.0f);
fade.setDuration(200);
view.startAnimation(fade);
view.setVisibility(View.VISIBLE);
mRefreshPbar.setVisibility(View.INVISIBLE);
mRefreshBtn.setVisibility(View.VISIBLE);
updateActionView();
mWebview.loadUrl("javascript:(function() { " +
"if (typeof(document.getElementsByClassName('ui-footer')[0]) != 'undefined' && document.getElementsByClassName('ui-footer')[0] != null){"+
"document.getElementsByClassName('ui-footer')[0].style.display = 'none';"+
"})()");
}
但它不起作用。有什么问题?
答案 0 :(得分:3)
您需要调用void 0
以防止浏览器重定向到纯文本文件。
mWebview.loadUrl("javascript:if (typeof(document.getElementsByClassName('ui-footer')[0]) != 'undefined' && document.getElementsByClassName('ui-footer')[0] != null){document.getElementsByClassName('ui-footer')[0].style.display = 'none';} void 0");