3

ViewSwitcher最初に表示されるビューが画面の中央にある回転進行状況インジケーターであるレイアウトを作成しようとしています。これは、読み込まれるとコンテンツが追加される線形レイアウトに切り替わります。

問題は、回転インジケーターを中央に配置したいmatch_parentので、画面の中央に配置できるようにすべてを設定することです。ただし、これは機能せず、次の警告が表示されます。

この ViewSwitcher は android:layout_height="wrap_content" を使用する必要があります

レイアウトは、 に設定されているかのように表示されwrap_contentます。回転インジケータが画面の中央に表示されるようにするにはどうすればよいですか?

ありがとう。

私のコード:

<LinearLayout 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"
    android:background="#FFF"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/svXorBox"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ViewSwitcher
            android:id="@+id/vsCollection"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:id="@+id/llBusy"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center" >

                <ProgressBar
                    android:id="@+id/progressBar1"
                    style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/llCollection"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >
            </LinearLayout>
        </ViewSwitcher>
    </ScrollView>

</LinearLayout>
4

0 に答える 0