开发者

WebView height change

I am trying to implement a webview such that

     tv1=new WebView(this);  
 tv1.getSettings().setSupportZoom(false);
 tv1.setHorizontalScrollBarEnabled(false); 
 tv1.setBackgroundColor(Color.TRANSPARENT);

 tv1.set


 params=new RelativeLayout.LayoutParams(width(280),LayoutParams.WRAP_CONTENT);
 params.topMargin=height(5);
 params.leftMargin=width(9);
 txt_rl.addView(tv1, params);

  textstr = ""+hm.get("fineprint");                  
    String tempo="<html><body><p ><font color='black'>" +
    ""+textstr
    +"</font></p></body></html>";
    tv1.loadDataWithBaseURL("", tempo, "text/html", Encoding.UTF_8.toString(),"");

now on click开发者_运维问答 of two button i need to change the content of the webview. But wrap content is not working. It always take the height which have more.

please help.


Give the WebView a parentView and make that the costum View, then let the WebView match his parent's width/height

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜