我有一个带有三个选项卡的片段。在其中一个选项卡上,我有一个对话框,在后台同步正在进行时进行旋转。但是我需要能够在后台同步正在进行时继续在其他部分上工作。部分屏幕上的进度对话框
我目前使用dialog.setCancelable(false)
退出对话框,以便我可以使用应用程序的其余部分。但是,这给了我一个在同步正在进行的片段上的图案屏幕。
有什么办法让对话只覆盖屏幕的一部分(只有同步进行的片段)吗?换句话说,一个不占用整个屏幕的对话框,以便我可以移动到其他选项卡而不取消对话框?在Java代码中对话框的
实现:
dialog = new Dialog(getActivity());
dialog.requestWindowFeature(Window.FEATURE_PROGRESS);
dialog.setCancelable(true);
dialog.setContentView(R.layout.dialog_progress_bar);
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
dialog.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/dialogProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>
你为什么不使用在fragmnet的XML'progressBar'通俗易懂而不是显示在'Dialog'呢? – tahsinRupam
是的,它的工作原理。谢谢 – leoOrion