使用ListActivity

android.app
类 ListActivity

java.lang.Object
  继承者 android.content.Context
      继承者 android.content.ContextWrapper
          继承者 android.view.ContextThemeWrapper
              继承者 android.app.Activity
                  继承者 android.app.ListActivity
所有已实现的接口:
ComponentCallbacks, KeyEvent.Callback, LayoutInflater.Factory, View.OnCreateContextMenuListener, Window.Callback
直接已知子类:
LauncherActivity, PreferenceActivity


package com.example.android_test;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;

public class MyListActivity extends ListActivity{
	
	private String[] array = {"AAAA","BBBB","CCCC","DDDD"};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		
		ListAdapter adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,array);

		setListAdapter(adapter);
	}

}


你可能感兴趣的:(android)