package com.example.com.lixiaolong_12; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; /** * Created by 李小龙 on 2018/1/13. */ public class ContentFragment_ extends Fragment{ private Button btn; private WebView wv; public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.contentfragment_,container,false); btn = view.findViewById(R.id.btn1); wv = view.findViewById(R.id.wv); wv.setWebViewClient(new WebViewClient()); //显示在视图里 btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { wv.loadUrl("http://www.baidu.com"); } }); return view; } }
《Webview》 + 链接 + 页面
最新推荐文章于 2023-04-15 15:04:09 发布