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

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]

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

报告相同问题?