当前位置: 首页>>代码示例>>Java>>正文


Java WebView.getParent方法代码示例

本文整理汇总了Java中android.webkit.WebView.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.getParent方法的具体用法?Java WebView.getParent怎么用?Java WebView.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clearWebView

import android.webkit.WebView; //导入方法依赖的package包/类
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;


    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:24,代码来源:AgentWebUtils.java

示例2: onCreateView

import android.webkit.WebView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_player, container, false);

    WebView playerWebView = ((MainActivity)getActivity()).playerWebView;

    LinearLayout playerContainer = view.findViewById(R.id.player_container);

    if(playerWebView.getParent() != null)
        ((ViewGroup)playerWebView.getParent()).removeView(playerWebView);

    playerWebView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
    playerContainer.addView(playerWebView);

    LinearLayout chatContainer = view.findViewById(R.id.chat_container);
    if(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("enable_chat", true) && !getArguments().getBoolean("video")) {
        WebView chatWebView = ((MainActivity)getActivity()).chatWebView;

        if(chatWebView.getParent() != null)
            ((ViewGroup)chatWebView.getParent()).removeView(chatWebView);

        chatWebView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
        chatContainer.addView(chatWebView);
    } else {
        View infoView = inflater.inflate(R.layout.fragment_stream_info, container, false);

        infoView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
        chatContainer.addView(infoView);

        TextView titleText = chatContainer.findViewById(R.id.infoStreamTitle);
        titleText.setText(getArguments().getString("title"));
    }

    return view;
}
 
开发者ID:invghost,项目名称:NeoStream,代码行数:37,代码来源:PlayerFragment.java

示例3: onDestroy

import android.webkit.WebView; //导入方法依赖的package包/类
/** Called when the activity is finally destroyed or in portrait-landscape switch. */
  @Override
  public void onDestroy()	{
// mhistoricalRecMgr.flush();	// shouldn't be done here because onDestroy is not called when switch to home screen and put smartmath background.

  	// release memory of wvOutput.
  	WebView wvOutput = (WebView) findViewById(R.id.webviewSmartMathOutput);
  	if (wvOutput != null)	{
	ViewGroup viewGroup = (ViewGroup) wvOutput.getParent();
	if (viewGroup != null)
	{
		viewGroup.removeView(wvOutput);
	}
	wvOutput.setFocusable(true);
	wvOutput.removeAllViews();
	wvOutput.clearHistory();
	wvOutput.destroy();
  	}
  	if (isFinishing())	{
  		MFPAdapter.clear();
  	}
  	try	{
  		super.onDestroy();
  	} catch(Exception e)	{
  		// have to add this for Amazon because at com.amazon.android.Kiwi.onDestroy(Unknown Source) it may throw exceptions.
  	}
  	if (isFinishing())	{
  		System.exit(0);	// clear memory so that if adView get problem, it can really restart.
  	}
  }
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:31,代码来源:ActivitySmartCalc.java


注:本文中的android.webkit.WebView.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。