2

RSSフィードを取得するためのアプリがあり、プルして更新を実装しようとしています。https://github.com/johannilsson/android-pulltorefreshから参照しました。誰かがこれをEclipseに含めるのを手伝ってもらえますか?このための瓶はありますか?

4

2 に答える 2

2

次の手順に従います。

日食で[ファイル] ->[新規] ->[その他]を実行し([ファイル]->[新規]-> [Androidアプリケーションプロジェクト]を使用しないでください)、[既存のコードからのAndroidプロジェクト]を選択します。

[次へ]をクリックし、pulltorefreshライブラリのあるディレクトリを参照します。ファイルをワークスペースにコピーする場合は、[プロジェクト]リストボックスの下のチェックボックスを選択します。次に、[完了]ボタンをクリックします。

今行ったことを繰り返しますが、今回はpulltorefreshexampleディレクトリを選択します。

これらのプロジェクトが両方とも開いていることを確認してから、パッケージエクスプローラーでpulltorefreshexampleを選択し、右クリックしてプロパティを選択します。表示されるウィンドウで、左側にある[Android]を選択すると、一番下に[ライブラリ]セクションがあります。[追加]をクリックすると、開いているすべてのライブラリプロジェクトのリストが表示されます。pulltorefreshを選択します。

ライブラリをクリーンアップしてビルドしてから、サンプルをクリーンアップしてビルドします。

于 2013-01-15T07:08:39.127 に答える
0

Androidにはまだ直接のコントロールがないため、このビデオとこのページ(コード付き)を参照して実装できます

いくつかのスニペット:xml内:

<!--
  The PullToRefresh-ListView replaces a standard ListView widget,
  and has all the features android.widget.ListView has.
-->
<eu.erikw.PullToRefreshListView
    android:id="@+id/pull_to_refresh_listview"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent" />

活動について:

// Set a listener to be invoked when the list should be refreshed.
PullToRefreshListView pullToRefreshView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener<ListView>() {
    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        // Do work to refresh the list here.
        new GetDataTask().execute();
    }
});

private class GetDataTask extends AsyncTask<Void, Void, String[]> {
    ...
    @Override
    protected void onPostExecute(String[] result) {
        // Call onRefreshComplete when the list has been refreshed.
        pullToRefreshView.onRefreshComplete();
        super.onPostExecute(result);
    }
}
于 2013-01-15T07:05:14.750 に答える