I need to show my webview content over parent background pattern. Is there a straightforward way to do it?
相关问题
- Android Exclude Some Camera Intent
- How to properly use Weld in JavaFX 2 application?
- WebView ssl error
- Xcode UI Testing - Finding element in Webview by i
- Unable to Full Screen Youtube Video Inside Custom
相关文章
- Check if url is cached webview android
- WebView's LOAD_NO_CACHE setting still saves fi
- How do I see request headers on Android WebView re
- How to change the color of pane in javafx?
- TableView has more columns than specified
- How to merge cells in JavaFX Scene builder?
- How to manage the Blank White Loading screen of an
- Xcode Wkwebview not Loading
This might be useful
I'm resurrecting this because I found a better solution for the problem of having a
WebView
over a gradient. Suppose you have a gradient like this and want to display an HTML string over it in white color that looks something like this:The trick is to convert your gradient to Base64 string:
Since
WebView
loads any HTML string, this can involve<body>
that has a background. In my instance, theWebView
was not occupying the whole space with the gradient, so I had to position the background as well. Following is the HTML I added to the HTML string above at the beggining:And at the end:
Therefore producing such code:
You could probably put the styles in the
<head>
or load them some other way for clarity I suppose, but this is a much better work-around to anything else I found on the net for this issue.You can Chroma Key your WebView over your content using Blend effects.
Update
I tried this out and implementing a true Chroma Key with the built-in Blend effects of JavaFX 2.2 in JavaFX is actually pretty difficult (and surpassed my capabilities of implementing). I managed to make the technique work with pre-chroma keyed flv video formats, but not with arbitrary nodes such as WebView.
Still, for now, you can achieve something somewhat similar in a simple way using the darken and lighten effects as martini suggests in his answer. It's not perfect, but will probably need to suffice until RT-25004 is implemented or the JavaFX platform provides a more comprehensive set of alpha compositing operations.
If u have a bright background use
and when dark background, then
This will probably be fixed in some time, this feature is requested on the JavaFX bug tracker #RT-25004
Webview transparent I get a good solution here : https://javafx-jira.kenai.com/browse/RT-29186 read comments Harry Hur