我有一個ProgressBar
,當加載WebView
時顯示。我希望ProgressBar
顯示爲小尺寸,而背景爲黑色。然後,我可以在WebView加載時關閉進度條。WebView在進度條加載時顯示爲白色
我遇到的問題是WebView
在加載時是白色的。有什麼辦法讓它變黑嗎?如果我將WebView
的背景顏色設置爲黑色,短暫一秒,它仍然是白色的,並且使加載非常難看。
活動的佈局是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/WebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<ProgressBar
android:id="@+id/ProgressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
或者,我應該使用某種形式的圖像看起來類似於Android的進度條?
都能跟得上添加此。那不起作用 – rajath 2013-05-02 10:02:42
在代碼中設置它爲我工作。我已經更新了答案,你可以試試嗎? – 2013-05-02 11:26:12
如果我嘗試這樣做,白屏出現的時間較短,儘管仍然存在 – rajath 2013-05-02 11:33:22