티스토리 뷰
Stack Overflow에 자주 검색, 등록되는 문제들과 제가 개발 중 찾아 본 문제들 중에서 나중에도 찾아 볼 것 같은 문제들을 정리하고 있습니다.
Stack Overflow에서 가장 먼저 확인하게 되는 가장 높은 점수를 받은 Solution과 현 시점에 도움이 될 수 있는 가장 최근에 업데이트(최소 점수 확보)된 Solution을 각각 정리하였습니다.
아래 word cloud를 통해 이번 포스팅의 주요 키워드를 미리 확인하세요.
Android WebView style background-color:transparent ignored on android 2.2
Android WebView 스타일 배경색: Android 2.2에서 투명 적용이 안됨
문제 내용
I'm struggling to create a WebView with transparent background.
배경이 투명한 웹뷰를 만드는 데 어려움을 겪고 있습니다.
webView.setBackgroundColor(0x00FFFFFF);
webView.setBackgroundDrawable(myDrawable);
Then I load a html page with
그런 다음 html 페이지를 로드합니다.
<body style="background-color:transparent;" ...
The background color of the WebView is transparent but as soon as the page is loaded, it's overwritten by a black background from the html page. This only happens on android 2.2, it works on android 2.1.
웹뷰의 배경색은 투명하지만 페이지가 로드되는 즉시 html 페이지의 검은색 배경으로 덮어씁니다. 이것은 안드로이드 2.2에서만 발생하며, 안드로이드 2.1에서 작동합니다.
So is there something to add in the html page code to make it really transparent ?
그렇다면 html 페이지 코드를 정말 투명하게 만들기 위해 추가해야 할 것이 있나요?
높은 점수를 받은 Solution
This worked for me,
이건 내게 효과가 있었어요.
mWebView.setBackgroundColor(Color.TRANSPARENT);
가장 최근 달린 Solution
This didn't work,
이건 안 먹혔지만,
android:background="@android:color/transparent"
Setting the webview
background color as worked
웹뷰 배경색 설정은 동작하였습니다.
webView.setBackgroundColor(0)
Additionally, I set window background drawable as transparent
또한, 저는 윈도우 백그라운드 drawable을 투명하게 설정합니다.
출처 : https://stackoverflow.com/questions/5003156/android-webview-style-background-colortransparent-ignored-on-android-2-2
'개발 > 안드로이드' 카테고리의 다른 글
텍스트뷰 링크를 클릭할 수 있도록 하는 방법 (0) | 2022.12.07 |
---|---|
'You need to use a Theme.AppCompat theme (or descendant) with this activity' 오류 수정하기 (0) | 2022.12.07 |
Android ADB로 인텐트 보내기 (0) | 2022.12.07 |
Android 1.6: "Android.view.WindowManager$BadTokenException 수정하기 (0) | 2022.12.06 |
Android 웹뷰 로딩 속도 문제 (0) | 2022.12.06 |