为webview添加头尾,可适用于textview

 
  
   StringBuffer sb = new StringBuffer();

//       sb.append(this.mContext.getString(R.string.html_coupon_begin));
            sb.append(this.mContext.getString(R.string.ios_html_coupon_begin));
            sb.append(mHtmlContent);
//       sb.append(this.mContext.getString(R.string.html_template_end));
            sb.append(this.mContext.getString(R.string.ios_html_end));

            // 测试用,by caisenchuan
            // KLog.d(TAG, "setMainView : " + sb.toString());
            // FileUtil.createNewFile(FileUtil.DIR_CACHE, "test.html",
            // sb.toString().getBytes());

            // 因为中英文切换的时候,可能会影响WebView内容的高度,所以此处进行重设
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            mWebView.setLayoutParams(params);
            mWebView.loadDataWithBaseURL(null, sb.toString(), "text/html",
                    "utf-8", null);
 
 
  
 
  
 
  
 
  
 
  
       <string name="html_begin">


    
        
        Dealmoon
        
        
        
        
        
        
        
            
        
    
    
    //防止webview复制粘贴
        
]]> string> <string name="html_end"> ]]> string>

你可能感兴趣的:(为webview添加头尾,可适用于textview)