1

これが正しい方法かどうかはわかりませんが、お役に立てば幸いです。

ListActivity を使用して、RSS フィードのコンテンツを表示しています。コンテンツの読み込み中に、保留中のビューを表示したいと考えています。そのウェブサイトhttps://github.com/commonsguy/cwac-endlessの EndlessAdapter を使用しています。保留中のビューを表示する方法を提供しますが、最初にデータをロードするときは空のリストの小さな行であるため、あまり魅力的ではありません。

私は実際にこの方法でこれを修正しようとしています: 最初の読み込みで非表示または表示できる保留中のビューがある ListActivity のカスタム レイアウト。レイアウトの XML コードは次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FFFFFF"
        android:cacheColorHint="#FFFFFF"/>


    <include
        android:id="@+id/progressBar"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        layout="@layout/loading_anim">
    </include>
</LinearLayout>

初めてデータをロードするとき、次の行でリストの可視性を gogo に設定します。

listView.setVisibility(View.GONE);

ほとんど機能していますが、含まれているレイアウトが画面全体を埋め尽くすわけではなく、これを適切な方法で修正する方法がわかりません.

誰かが私を助けてくれることを願っています、ありがとう!

更新: 読み込み中のレイアウト (以下の XML を参照) のみで contentview を設定しようとしましたが、同じ結果が得られました ( http://imageshack.us/photo/my-images/594/loadingwf.png/を参照):

this.setContentView(R.layout.loading_anim);

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:gravity="center_horizontal"
    android:orientation="horizontal"
    android:padding="5dp" >

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="@string/loading" />

</LinearLayout>

だから、タブが原因なのだろうかと思っています...誰か助けてくれますか?ありがとう

UPDATE 2 解決策を見つけました。それは、終わりのないアダプターとは何の関係もありませんでした。タブのコンテンツがスペース全体に表示されないを参照してください

4

1 に答える 1

1

ListView で、これを試してください。

<ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:cacheColorHint="#FFFFFF"/>

私がしたことは、layout_height を wrap_content に設定することでした。今すぐ画面全体を埋める必要があります。

于 2012-04-01T19:08:25.200 に答える