1.简单明了,直接上代码
public class LiveBBCCAgreementActivity extends BaseActivity implements LiveBBCCAgreeContract.LiveBBCCAgreeView {    private LinearLayout titleBar;    private WebView BBCCWebview;    private String URL;    private LiveBBCCAgreeContract.LiveBBCCAgreePresenter liveBBCCAgreePresenter;    @Override    protected int setContentLayout() {        return R.layout.live_activity_agreement;    }    @Override    protected void init() {        initTitleBar(titleBar, "协议", false, null);        BBCCWebview = (WebView) findViewById(R.id.BBCC_webview);        liveBBCCAgreePresenter = new LiveBBCCAgreePresenterImpl(this);        liveBBCCAgreePresenter.getLiveBBCCAgree();        WebSettings webSettings = BBCCWebview.getSettings();        /*js交互*/        webSettings.setJavaScriptEnabled(true);        /*自适应屏幕*/        webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小        webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小        /*细节操作*/        webSettings.setBuiltInZoomControls(true);        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持js弹窗        BBCCWebview.setWebViewClient(new WebViewClient());    }    @Override    protected void findView() {        titleBar = (LinearLayout) findViewById(R.id.title_bar_2);    }    @Override    protected void initData() {    }    @Override    protected void setListeners() {    }    @Override    public void onClick(View v) {    }    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        // TODO: add setContentView(...) invocation        ButterKnife.bind(this);    }    @Override    public void showLiveBBCCAgree(LiveBBCCAgreeBean liveBBCCAgreeBean) {        URL = ""+liveBBCCAgreeBean.getData().getContent()+"";        /**         * 将文本HTML显示在webview         */        BBCCWebview.loadDataWithBaseURL(null,URL,"text/html","utf-8",null);    }}
2.XML
<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">            android:id="@+id/title_bar_2"        layout="@layout/title_bar" />            android:id="@+id/BBCC_webview"        android:layout_width="match_parent"        android:layout_height="match_parent" />

更多相关文章

  1. android屏幕解锁
  2. Android屏幕投影及反向控制原理
  3. android 面试题 谈谈屏幕适配
  4. android缩放大图片加载
  5. [Android] 一种粗暴快速的 Android 全屏幕适配方案
  6. android自定义adapter 滑动屏幕时 进度条显示混乱

随机推荐

  1. 像Excel一样使用SQL进行数据分析
  2. Nginx 的动态变量指令map 的使用
  3. 网页设计与制作
  4. 数据分析必备5个EXCEL技巧,数据再多也不怕
  5. 开课啦 dubbo-go 微服务升级实战
  6. 你有一份经典SQL语句大全,请注意查收!!!
  7. python入门教程14-01 (python语法入门之py
  8. 【一点一滴,成材之基!】案例:企业安全项目--
  9. kubernetes常用控制器之Job和CronJob
  10. kubernetes其他控制器之PodDisruptionBud