与えられた
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".InboxActivity" >
<!-- refresh button -->
<Button
android:id="@+id/button_refresh_inbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:onClick="refreshInbox"
android:text="@string/refresh_inbox" />
<LinearLayout
android:id="@+id/inbox_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/button_refresh_inbox" >
<ProgressBar
android:id="@+id/inbox_prog_bar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/empty_inbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/inbox_container"
android:textIsSelectable="false" />
</RelativeLayout>
結果:
アプリを実行すると、エラーが発生します
E/AndroidRuntime(930): java.lang.ClassCastException: android.widget.ProgressBar
cannot be cast to android.widget.LinearLayout
これを修正する方法を知っている人はいますか?
目的:
受信トレイの読み込み中に表示するプログレス バーを取得します。次に、受信トレイのコンテンツで線形レイアウトを埋めます。
背景:
すべてが正常に機能しています。受信トレイの読み込み中に空白の画面ではなく、進行状況バーを表示する方がよいと思いました. プログレスバーを追加するとエラーが発生しました。(プログラムではなく、レイアウトファイルでプログレスバーを指定したいのですが)。