本文整理了Java中android.webkit.WebView.getParent()
方法的一些代码示例,展示了WebView.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.getParent()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:getParent
暂无
代码示例来源:origin: Justson/AgentWeb
static WebParentLayout getWebParentLayoutByWebView(WebView webView) {
ViewGroup mViewGroup = null;
if (!(webView.getParent() instanceof ViewGroup)) {
throw new IllegalStateException("please check webcreator's create method was be called ?");
}
mViewGroup = (ViewGroup) webView.getParent();
AbsAgentWebUIController mAgentWebUIController;
while (mViewGroup != null) {
LogUtils.i(TAG, "ViewGroup:" + mViewGroup);
if (mViewGroup.getId() == R.id.web_parent_layout_id) {
WebParentLayout mWebParentLayout = (WebParentLayout) mViewGroup;
LogUtils.i(TAG, "found WebParentLayout");
return mWebParentLayout;
} else {
ViewParent mViewParent = mViewGroup.getParent();
if (mViewParent instanceof ViewGroup) {
mViewGroup = (ViewGroup) mViewParent;
} else {
mViewGroup = null;
}
}
}
throw new IllegalStateException("please check webcreator's create method was be called ?");
}
代码示例来源:origin: Justson/AgentWeb
static final void clearWebView(WebView m) {
if (m == null) {
return;
}
if (Looper.myLooper() != Looper.getMainLooper()) {
return;
}
m.loadUrl("about:blank");
m.stopLoading();
if (m.getHandler() != null) {
m.getHandler().removeCallbacksAndMessages(null);
}
m.removeAllViews();
ViewGroup mViewGroup = null;
if ((mViewGroup = ((ViewGroup) m.getParent())) != null) {
mViewGroup.removeView(m);
}
m.setWebChromeClient(null);
m.setWebViewClient(null);
m.setTag(null);
m.clearHistory();
m.destroy();
m = null;
}
代码示例来源:origin: xinghongfei/LookLook
@Override
protected void onDestroy() {
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
getWindow().getSharedElementReturnTransition().removeListener(zhihuReturnHomeListener);
}
//webview内存泄露
if (wvZhihu != null) {
((ViewGroup) wvZhihu.getParent()).removeView(wvZhihu);
wvZhihu.destroy();
wvZhihu = null;
}
mIZhihuStoryPresenter.unsubscrible();
super.onDestroy();
}
代码示例来源:origin: TheFinestArtist/FinestWebView-Android
((ViewGroup) webView.getParent()).removeAllViews();
swipeRefreshLayout.addView(webView);
swipeRefreshLayout.removeViewAt(1);
代码示例来源:origin: limedroid/XDroidMvp
@Override
protected void onDestroy() {
super.onDestroy();
if (webView != null) {
ViewGroup parent = (ViewGroup) webView.getParent();
if (parent != null) {
parent.removeView(webView);
}
webView.removeAllViews();
webView.destroy();
}
}
代码示例来源:origin: limedroid/XDroid
@Override
protected void onDestroy() {
super.onDestroy();
if (webView != null) {
ViewGroup parent = (ViewGroup) webView.getParent();
if (parent != null) {
parent.removeView(webView);
}
webView.removeAllViews();
webView.destroy();
}
}
代码示例来源:origin: iTXTech/Daedalus
@Override
public void onDestroyView() {
super.onDestroyView();
if (mWebView != null) {
Log.d("DAboutActivity", "onDestroy");
mWebView.removeAllViews();
mWebView.setWebViewClient(null);
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.setTag(null);
mWebView.clearHistory();
mWebView.destroy();
mWebView = null;
}
}
}
代码示例来源:origin: evernote/evernote-sdk-android
private void destroyWebView() {
if (mWebView != null) {
ViewGroup viewGroup = (ViewGroup) mWebView.getParent();
if (viewGroup != null) {
viewGroup.removeView(mWebView);
}
mWebView.destroy();
mWebView = null;
}
}
代码示例来源:origin: Lovemma/ZhihuDaily
@Override
protected void onDestroy() {
if (mWebView != null) {
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.destroy();
mWebView = null;
}
super.onDestroy();
}
代码示例来源:origin: Lovemma/ZhihuDaily
@Override
protected void onDestroy() {
mPresenter.unSubcrible();
if (mWebView != null) {
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.destroy();
mWebView = null;
}
super.onDestroy();
}
代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK
public AsAdViewHolder(View view) {
super(view);
webView = AdsManager.getInstance().getWebView();
ViewGroup oldParent = (ViewGroup) webView.getParent();
if (oldParent != null) {
oldParent.removeView(webView);
}
((FrameLayout) view.findViewById(R.id.fl_web_view_container)).addView(webView);
}
代码示例来源:origin: Vegen/SmartCampus
@Override
protected void onDestroy() {
super.onDestroy();
// 解决webView带来的内存泄漏
if (webView != null) {
((ViewGroup) webView.getParent()).removeView(webView);
webView.destroy();
webView = null;
}
}
代码示例来源:origin: HelloChenJinJun/TestChat
@Override
protected void onDestroy() {
super.onDestroy();
if (display != null) {
((ViewGroup) display.getParent()).removeView(display);
display.destroy();
display = null;
}
}
代码示例来源:origin: zfman/hputimetable
@Override
protected void onDestroy() {
if (webView!= null) {
webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
webView.clearHistory();
((ViewGroup) webView.getParent()).removeView(webView);
webView.destroy();
webView= null;
}
super.onDestroy();
}
}
代码示例来源:origin: 8enet/AppOpsX
@Override
protected void onDestroy() {
try {
((ViewGroup) webView.getParent()).removeView(webView);
webView.removeAllViews();
webView.destroy();
} catch (Exception e) {
e.printStackTrace();
}
super.onDestroy();
}
}
代码示例来源:origin: Carson-Ho/Webview_Cache
@Override
protected void onDestroy() {
if (mWebview != null) {
mWebview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
mWebview.clearHistory();
((ViewGroup) mWebview.getParent()).removeView(mWebview);
mWebview.destroy();
mWebview = null;
}
super.onDestroy();
}
}
代码示例来源:origin: mnnyang/ClassSchedule
@Override
protected void onDestroy() {
super.onDestroy();
if (mWebView != null) {
mWebView.clearHistory();
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.loadUrl("about:blank");
mWebView.stopLoading();
mWebView.setWebChromeClient(null);
mWebView.setWebViewClient(null);
mWebView.destroy();
mWebView = null;
}
}
}
代码示例来源:origin: 736008081/frameAndroid
@Override
protected void onDestroy() {
super.onDestroy();
if (mWebView != null) {
((ViewGroup) mWebView.getParent()).removeView(mWebView);
mWebView.removeAllViews();
mWebView.destroy();
}
}
}
代码示例来源:origin: Vegen/SmartCampus
@Override
protected void onDestroy() {
super.onDestroy();
// 解决webView带来的内存泄漏
if (webView != null) {
((ViewGroup) webView.getParent()).removeView(webView);
webView.destroy();
webView = null;
}
UMShareAPI.get(this).release();
}
代码示例来源:origin: KosyanMedia/Aviasales-Android-SDK
@Override
public boolean onBackPressed() {
dismissDialogFragment();
if (webView != null) {
webView.setVisibility(View.INVISIBLE);
((ViewGroup) webView.getParent()).removeAllViews();
webView.clearHistory();
webView.clearCache(true);
webView.destroy();
webView = null;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!