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]

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

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)