我一直在尝试解决这个问题,但在网上找不到任何帮助。基本上我只需要为这些项目设置一个 onItemClickListener。他们所要做的就是开始一项新活动的新意图。
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MyAppActivity extends Activity {
/** Called when the activity is first created. */
private ListView list1;
private String Cats[] = { "Hardware", "Commands", "Libraries","Tutorials", "Arduino License"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
list1 = (ListView) findViewById(R.id.ListView01);
// By using setAdpater method in listview we an add string array in
// list.
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, Cats);
list1.setAdapter(adapter);
}
}
有什么帮助吗?