How may I assign image to Background in HTML using android URI ?
代码示例:
// Getting images From Camera or Gallery
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
Uri imageUri = CropImage.getPickImageResultUri(this, data);
UserAppSettings.setSplashScreen(imageUri); //Model
}
}
在Web背景中设置CSS和图像
//Create String to Change Image Dynamically
public static String htmlDocument = "<html><head><style>.splash {
background: url('"+UserAppSettings.getSplashScreen()+"');
}</style><body><div class="splash"></div></body></head></html>";
将修改过的字符串放入JAVA代码:
webView.loadDataWithBaseURL("file:///android_asset/", UserWebPage.htmlDocument,
"text/html", "UTF-8", "");
but this is not working on my side and I am getting Uri very fine
content://com.android.providers.media.documents/document/image%3A52530