Android:どのように作モードの進捗"輪"ですか?
-
18-09-2019 - |
質問
良野の落合にて設立されましたモーダルの進捗"ホイール"オーバーレイに思います。
は、ProgressDialogがありがたくないダイアログの背景には不可とします。
また設定の背景描のダイアログウィンドウ
this.progressDialog = new ProgressDialog(Main.this);
this.progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
this.progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
this.progressDialog.setCancelable(false);
this.progressDialog.setIndeterminate(true);
this.progressDialog.show();
が無い(まだ見同じなの---setBackgroundDrawableコードとします。
解決
あなたがこのチュートリアルにチェックアウトしたことがありますか?ページの終わりには、カスタムダイアログを作成する方法について語り、それはあなたがあなた自身の背景を持つスピナー進行状況ダイアログボックスを置くに役立つかもしれない。
他のヒント
だが、より良いものを取得できホイールスピンナー自らを使用 ProgressBar 設定できinterdeterminate.を使用している場合には、これは AbsoluteLayout きです。このレイアウトに明示する必要があるとともにこのメソッドはXML:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout android:id="@+id/AbsoluteLayout"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ProgressBar android:id="@+id/ProgressBar"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:indeterminate="true" android:indeterminateOnly="true"
android:isScrollContainer="true" android:layout_x="100dip"
android:layout_y="10dip" android:soundEffectsEnabled="true"></ProgressBar>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello"
android:layout_gravity="center_horizontal" android:gravity="center_horizontal"
android:layout_y="25dip" />
</AbsoluteLayout>
IはでframeLayoutを使用し、長い操作が行われた場合に必要またはGONE場合VISIBLEにRelativeLayoutの可視性を設定暗い背景上のフルスクリーンの進行を作成するために
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:padding="3dip" >
<!-- Your regular UI here -->
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/relativelayout_progress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:background="#aa000022" >
<ProgressBar
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateOnly="true" />
</RelativeLayout>
</FrameLayout>
Klarthのソリューションは、私のために働いた、ありがとう!
私の場合、私はむしろ、明示的な座標を使用するよりも、progress_indicatorの中央に配置するためlayout_gravityを使用します。
<ProgressBar android:id="@+id/pb"
android:layout_width="40dp"
android:layout_height="40dp"
android:indeterminate="true"
android:indeterminateOnly="true"
android:isScrollContainer="true"
android:layout_gravity="center_vertical|center_horizontal"
android:soundEffectsEnabled="false"
/>
所属していません StackOverflow