如果要在应用程序中使用ListView,则可以直接使用它而不扩展ListActivity。像这样
public class PullToRefreshActivity extends AppCompatActivity { private LinkedListmListItems; PullToRefreshListView listView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pull_to_refresh); listView = (PullToRefreshListView) findViewById(R.id.list_view); // Set a listener to be invoked when the list should be refreshed. listView.setOnRefreshListener(new PullToRefreshListView.OnRefreshListener() { @Override public void onRefresh() { // Do work to refresh the list here. new GetDataTask().execute(); } }); mListItems = new LinkedList (); mListItems.addAll(Arrays.asList(mStrings)); ArrayAdapter adapter = new ArrayAdapter (this, android.R.layout.simple_list_item_1, mListItems); listView.setAdapter(adapter); }