webview gallery
I am new to android developement. Now I am doing webview gallery. In this gallery I load some images and i set layout for
mWebView.setLayoutParams(new Gallery.LayoutParams(70,85));
this 70 and 85 is height and width for webview but when the images are webview.loadurl that time some big and some small images are load... so problem is images are display more than width size and some lower than width then i won't set dynamically set height and width. It's height and width depend on whaterver images are comes for url ...see the below code then u can understand more detail .........
public View getView(int position, View convertView, ViewGroup parent) {
WebView mWebView = new WebView(mContext);
mWebView.loadUrl(it2[position]);
mWebView.setWebViewClient(new WebViewClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setLayoutParams(new Gallery.LayoutParams(70,85));
WebSettings webSettings = mWebView.getSettings();
m开发者_高级运维WebView.setBackgroundColor(0);
mWebView.setInitialScale(100);
mWebView.setFocusable(false);
mWebView.setClickable(false);
mWebView.setWebViewClient(new HelloWebViewClient());
return mWebView;
}
}
I am not sure I understood everything, but if you want to change the image image size, you shouldn't play with the webview layoutparams. This will not change imaegsize.
You might change the imagesize by playing with HTML code: something like:
<img border="0" src="./mypicture.jpg" height="800px" width="600px">image1</img>
You can also have a look here:
Can Android's WebView automatically resize huge images?
精彩评论