回答

1

在示例代碼,在每個活動(網格/列表等),例如:PullToRefreshListActivity.java有一個叫做方法:

refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label); 

mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { 
    @Override 
    public void onRefresh(PullToRefreshBase<ListView> refreshView) { 
    String label = DateUtils.formatDateTime(getApplicationContext(),System.currentTimeMillis(), 
    DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); 

    // Update the LastUpdatedLabel 
    refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label); 

    // Do work to refresh the list here. 
    new GetDataTask().execute(); 
} 
}); 

,更新文本的方法

和日期由代碼創建:

String label = DateUtils.formatDateTime(getApplicationContext(),System.currentTimeMillis(), 
     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); 
+0

那麼我該如何互換日期和時間?我只需要這樣做嗎?String label = DateUtils.formatDateTime(getApplicationContext(),System.currentTimeMillis(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL);它沒有顯示任何結果? –

+0

nvm,得到了下面發佈的解決方案,謝謝你的幫助! –