WebView的简单应用及跳转到线上的子app和tag导航渐变

1.WebView加载网页全屏播放视频及下载等

2.tag底部导航渐变色

3.对子app的启动 一个app

项目地址:http://www.devstore.cn/code/info/1782.html#0-tsina-1-44373-397232819ff9a47a7b7e80a40613cfe1

// 加载web
@SuppressLint({ "SetJavaScriptEnabled", "InlinedApi", "NewApi" })
private void LoadUrl() {
    // TODO Auto-generated method stubs
    // 设置WebView属性,能够执行Javascript脚本
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.setWebChromeClient(new DefaultWebChromeClient()); // 播放视频
    webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.setDownloadListener(new MyWebViewDownLoadListener());   
    webView.loadUrl(path);
}
 
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
 
    // 得到绘制icon的宽
    int bitmapWidth = Math.min(getMeasuredWidth() - getPaddingLeft()
            - getPaddingRight(), getMeasuredHeight() - getPaddingTop()
            - getPaddingBottom() - mTextBound.height());
 
    int left = getMeasuredWidth() / 2 - bitmapWidth / 2;
    int top = (getMeasuredHeight() - mTextBound.height()) / 2 - bitmapWidth
            / 2;
    // 设置icon的绘制范围
    mIconRect = new Rect(left, top, left + bitmapWidth, top + bitmapWidth);
 
}

猜你喜欢

转载自blog.csdn.net/qq_35350654/article/details/81586983