3

Possible Duplicate:
@Android display /res/viewable in WebView

Is it possible to use drawables (shape, gradient, etc.) in WebView (inside img tag)?

P.S. I've read this answer. So, I know how to insert image, but what about other drawables?

EDIT

For example: I need to display circle in WebView (without using canvas).

Community
  • 1
  • 1
Dmitry Zaytsev
  • 23,650
  • 14
  • 92
  • 146
  • @TryTryAgain, as I said (twice) I don't need an image. However, thanks. – Dmitry Zaytsev May 15 '12 at 13:48
  • sorry I thought that would be interchangable with XML drawables, would this be more suitable: http://stackoverflow.com/questions/1260422/setting-webview-background-image-to-a-resource-graphic-in-android ? – TryTryAgain May 15 '12 at 13:54
  • I guess I'm not exactly sure of the specific use you are looking for, in the question's current state, but would using an external layout be an option? http://www.mkyong.com/android/android-webview-example/ – TryTryAgain May 15 '12 at 14:20
  • Comment on closing this question: answers to previous question may no longer be valid. See answer to http://stackoverflow.com/questions/9105913/android-4-0-webview-loadurl-oddity for why. – Lawrence D'Oliveiro May 21 '12 at 10:17

1 Answers1

3

You can insert Base64-encoded image data directly in the URL for the <IMG...> tag. The URL format is “data:mimetype;base64,data”. For example see here.

Lawrence D'Oliveiro
  • 2,768
  • 1
  • 15
  • 13
  • Looks like it will work ) At least now I can compress Drawable into Bitmap, get byte array from Bitmap and then encode array as Base64. – Dmitry Zaytsev May 16 '12 at 10:28