我有一个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