一、在Activity1中
创建适配器的点击事件:
-
myRecyclerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
-
-
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
-
Intent intent = new Intent(getContext(), MainActivity2.class);
-
intent.putExtra("hh",data.get(position));
-
startActivity(intent);
-
}
-
});
二、在Activity2的Xml中
-
<ImageView
-
android:id="@+id/mage"
-
android:layout_width="match_parent"
-
android:layout_height="200dp" />
-
-
<WebView
-
android:id="@+id/mWebView"
-
android:layout_width="match_parent"
-
android:layout_height="wrap_content">
-
-
</WebView>
三、在Activity2中
-
Intent intent = getIntent();
-
Bean1.BodyBean.ResultBean.DataBean hh = (Bean1.BodyBean.ResultBean.DataBean) intent.getSerializableExtra("hh");
-
Glide.with(MainActivity2.this).load(hh.getClassCoverPic()).into(mage);
-
WebSettings settings = WebView.getSettings();
-
settings.setJavaScriptEnabled(true);
-
WebView.loadUrl("http://news.163.com/18/0730/17/DNVSHE6F000189FH.html");
-
WebView.setWebViewClient(new WebViewClient(){
-
-
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
-
WebView.loadUrl("http://news.163.com/18/0730/17/DNVSHE6F000189FH.html");
-
return true;
-
}
-
});
因为我的接口没有url,所以我直接给传的网址,如果接口当中有url的话,name直接传集合点url即可!
转载请注明出处: