Android : 모달 진행 상황 "휠"오버레이를 만드는 방법은 무엇입니까?

StackOverflow https://stackoverflow.com/questions/2409063

  •  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();

그러나 아무 소용이 없다 (즉, 여전히 ... 설정된 코드가없는 것과 같다).

도움이 되었습니까?

해결책

당신은 이것을 확인 했습니까? 지도 시간? 페이지가 끝나면 사용자 정의 대화 상자를 만드는 방법에 대해 이야기하고이를 통해 자신의 배경으로 스피너 진행 대화 상자를 넣는 데 도움이 될 수 있습니다.

다른 팁

더 나은 방법이 있는지 확실하지 않지만 사용하여 스피너 휠을 자체적으로 얻을 수 있습니다. 진행 표시 줄 그리고 그것을 주정부로 설정합니다. 당신이 사용하는 경우 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>

어두워 진 배경에서 전체 화면 진행을 만들기 위해 FramelAyout을 사용하고 긴 작업이 완료 될 때 필요한 경우 또는 사라질 때 친척의 가시성을 표시하도록 설정합니다.

<?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의 솔루션이 저를 위해 일했습니다. 감사합니다!

제 경우에는 명시 적 좌표를 사용하지 않고 진행 _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"
        />
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top