Ere*_*aut 2 android webview imageview
我正在制作一个带有网络视图的应用程序。这个 webview 需要一些时间来加载 url,所以我希望 Imageview 在消失之前显示大约 3 秒。这是我的布局文件。应用程序启动后 3 秒后,如何交换这两个视图的可见性?
<ImageView android:id="@+id/imageLoading1"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:visibility="visible"
android:src="@drawable/logo"
/>
<android.webkit.WebView
android:id="@+id/wvwMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
>
Run Code Online (Sandbox Code Playgroud)
new Handler().postDelayed(new Runnable() {
public void run() {
findViewById(R.id.imageLoading1).setVisibility(View.GONE);
findViewById(R.id.wvwMain).setVisibility(View.VISIBLE);
}
}, 3000);
Run Code Online (Sandbox Code Playgroud)
这将在后台等待 3 秒,然后切换回 UI 线程并设置可见性。
| 归档时间: |
|
| 查看次数: |
2026 次 |
| 最近记录: |