jimychen2009 2010-03-29 22:13
浏览 400
已采纳

android webview透明设置

请问android中如何设置透明,使得能背景没有,就是能够直接看到图片,让字相当于悬浮在背景之上的效果,或者是能通过css之类的来实现么?

  • 写回答

1条回答 默认 最新

  • suziwen 2010-03-29 23:51
    关注

    [quote]To achieve transparency both the view's background drawable, which is inherited, and the WebView's backgroundColor variable must be assigned values of 0. The first may be accomplished through either a call to setBackgroundDrawable(), or the android:background tag in the xml. The second is set by calling setBackgroundColor().[/quote]

    [quote]As always you tend to figure these things out as soon as you ask the question. For the benefit of others, the layout that I'm using, LinearLayout, can take a background parameter that can be a colour or a resource.

    So in my views .xml file I simply added a

    android:background="@+drawable/backgroundmain"
    and use

    web.setBackgroundColor(0);
    To make the webview transparent to see the background image behind.[/quote]

    [url]http://stackoverflow.com/questions/1260422/setting-webview-background-image-to-a-resource-graphic-in-android[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站