final WebView cotent = (WebView) findViewById(R.id.cotent);
String baseUrl = "file:///android_res/drawable/";//读取本地图片路径
cotent.loadDataWithBaseURL(baseUrl, infoForum.getContent() + "</br> <img src=\"/android_res/drawable/d_aini.png\"/> ", "text/html", "utf-8", null);
cotent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
System.out.println("cotent.getHeight()===" + cotent.getHeight());//返回的是View的高度
System.out.println("cotent.getContentHeight()===" + cotent.getContentHeight());//返回的是Html的高度
System.out.println("cotent.getMeasuredHeight()===" + cotent.getMeasuredHeight());//返回的是View的高度
}
});
学习网址:http://blog.csdn.net/linghu_java/article/details/46544811