本文介绍了设置背景图片为Android的网页视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想设置一个背景图像中的Android网页视图。
我做了以下内容:
webView.setBackgroundColor(0);
webView.setBackgroundResource(R.drawable.backgroundImage);
我想要的图像是在网页视图的中间。任何帮助吗?
修改
我已经找到了解决办法:
linearLayout.setGravity(Gravity.CENTER);
imageView.setBackgroundResource(R.drawable.backgroundImage);
linearLayout.addView(ImageView的);
frameLayout.addView(LinearLayout中);
frameLayout.addView(web视图);
解决方案
这下面正常工作对我来说 -
的WebView myWebView =(的WebView)findViewById(R.id.myWebView);
myWebView.setBackgroundColor(Color.parseColor(#000000));
I want to set a background image for a webview in android.I did the following:
webView.setBackgroundColor(0);
webView.setBackgroundResource(R.drawable.backgroundImage);
I want the image to be in the middle of the webview. Any help please?
EDITI have found the solution:
linearLayout.setGravity(Gravity.CENTER);
imageView.setBackgroundResource(R.drawable.backgroundImage);
linearLayout.addView(imageView);
frameLayout.addView(linearLayout);
frameLayout.addView(webView);
解决方案
This below normally works for me -
WebView myWebView = (WebView) findViewById(R.id.myWebView);
myWebView.setBackgroundColor(Color.parseColor("#000000"));
这篇关于设置背景图片为Android的网页视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!